[CMake] Install target and Component (once more)

Nicolas Burrus nespub at free.fr
Thu Sep 13 04:14:08 EDT 2007


Hi,

After some mailing list browsing, I could not find any complete answer
to a recurrent request: how can we specify at configure time the
component which should be installed by the install rule?

Right now, I'm using the following custom rule:
ADD_CUSTOM_TARGET(install-runtime COMMAND ${CMAKE_COMMAND}
-DCOMPONENT=Runtime -P cmake_install.cmake)

But it implies running "make install-runtime" instead of the standard
"make install" (it seems like a custom target cannot replace a
predefined rule like "install").

Is there already a trick to avoid this? If the answer is no, let me
transform it into a feature request :-)

CPack handles this properly, and I can't see any good reason (but I'm
not a cmake expert !) for Cmake not to automatically propagate the
CMAKE_INSTALL_COMPONENT variable into the cmake_install.cmake script,
like it already does for CMAKE_INSTALL_PREFIX.

This way, something like
SET(CMAKE_INSTALL_COMPONENT "Runtime") would do the job.

In particular, this feature would be really useful when a project
embbeds some library subprojects, whose header files should not be
installed when they are just used to build the main program.

Thanks,
Nicolas Burrus


More information about the CMake mailing list