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

Alexander Neundorf a.neundorf-work at gmx.net
Thu Jul 26 11:34:15 EDT 2007


On Thursday 26 July 2007 11:25, Christian Convey wrote:
> 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?

Yes.

You need to use the new INSTALL() commands together with the COMPONENT 
argument.
So e.g.
install(FILE foo.h bar.h DESTINATION include COMPONENT Headers)
install(TARGETS mylib    DESTINATION lib     COMPONENT Libraries)
etc.
The names of the components can be chosen freely (don't use "Default").

You still can do only "make install", but you can execute the install script 
manually, that's the same as what make install does:
$ cmake -DCMAKE_INSTALL_COMPONENT=Headers -P cmake_install.cmake

If it doesn't work, let us know.

Bye
Alex


More information about the CMake mailing list