[CMake] Controlling what "install" does at make-time ?

Christian Convey christian.convey at gmail.com
Thu Jul 26 11:25:49 EDT 2007


I'd like "make install" to install different (named) subsets of files,
depending on my needs.  For example, "make output=header-files
install" or "make output=libraries install".

Is what I'm trying to accomplish even possible?  I can't figure out
how to make this controllable at make-time.  I can only seem to make
it controllable at ccmake time.

I was thinking to accomplish this by having, inside my CMakeLists.txt
files, something like this:

IF ("${output}" STREQUALS "header-files")
   INSTALL_TARGETS(...)
ELSE (...)
   INSTALL_TARGETS(...)
ENDIF (...)

I tried something that looked more flexible: branching based on
environent variables.

IF ("$ENV(output)" STREQUALS "header-files")
   INSTALL_TARGETS(...)
ELSE (...)
   INSTALL_TARGETS(...)
ENDIF (...)

But this too seems to specify *at ccmake time* which branch will be taken.

Any ideas?

I realize that I could create multiple cmake_binary_dirs, one for each
configuration.  But this whole process will ideally be driven by
CMake, and I'm concerned that having CMake invoke CMake will make the
system hard to understand and debug.

Thanks,
Christian


More information about the CMake mailing list