[CMake] Selective build and install of subfolders
screamingfist at arcor.de
screamingfist at arcor.de
Mon Jan 7 03:31:23 EST 2013
Hello list,
I have a project with subfolders that should be selectively built and installed. The problem ist that there are various dependencies between them.
At the moment I have a list-variable that contains the targets I want to be built and the folders are included depending on this list:
$ cmake -DWANTED="this;that"
A folder is included with ADD_SUBDIRECTORY if it is explicitly named in the list or is needed as dependency of another target - done with multiple LIST(FIND) commands. This way I'm functionally recreating the dependency list that is also built by ADD_DEPENDENCIES and TARGET_LINK_LIBRARIES.
I searched the documentation for a better solution, but found only these things that seem related at first glance but don't do what I want:
- Using EXCLUDE_FROM_ALL in ADD_SUBDIRECTORY, ADD_EXECUTABLE or ADD_LIBRARY. This should handle dependencies, but the docs say: "Installing a target with EXCLUDE_FROM_ALL set to true has undefined behavior."
- Using COMPONENT in INSTALL commands. Does not affect compilation, just installation and does not handle dependencies.
So my question: Am I missing something or is it not possible to do selective build and install without the fuss of recreating the dependencies?
Thanks
Stefan
More information about the CMake
mailing list