[CMake] "Special" targets, and renaming packages

Benoît Bleuzé benoit.bleuze at 1000shapes.com
Mon Sep 28 09:40:23 EDT 2015


Hi all,
I understand targets such as "install" and "package" are special
targets, and that one can not depend on them.
I have found in the mailing list's archive an old thread mentioning that
very problem
(http://cmake.org/pipermail/cmake/2009-November/033210.html), with an
allegedly existing bug on that topic.
Unfortunately I could not find any trace of such a bug report. Can
someone give me pointer on :

1 why are those targets not "dependable"?
2 What was the outcome of the old bug report (if someone know how to
find it) and its rationale?
3 Is there any plan to make them first class citizens?

Linked to this general question, I have a practical problem. The
PACKAGE_NAME variable is fairly limited.
When one uses components with the archive generator, one can not control
the output name of the packages in a simple variable.
This is fine, I guess creating package name variables for each component
would be silly.
However the problem would be solved with a target that would rename the
individual archives AFTER being generated.

As  a work around, at the moment I use the "configure_file" command to
create a bash script that calls this :

    cmake  --build @CMAKE_BINARY_DIR@ --target package --config
@PACKAGE_ORIG_CONFIG@

And then the script renames packages (archive components) with some
particular naming scheme.

This way I get my renamed packages AFTER building my packages, but I
need to run cmake a first time to configure the project and my script,
then this script can build and package the whole shebang.
The script is dumb enough (renaming 5 files after given some regular
expressions) that it can run on all platform (msysgit on Windows), but
it does not sound very cmake like to me.
Is there a better way out there to rename individual archive package
component?

Thanks for the help,
Ben.




More information about the CMake mailing list