[CMake] CMake install and CPack

Timothy M. Shead tshead at sandia.gov
Fri Nov 7 12:44:13 EST 2008


KSpam wrote:
> My project has hundreds of individual install components.  The various
> components are needed for my CPack scripts; however most (all but 1)
> components should not be installed as part of a normal "make install".
> Unfortunately, "make install" installs all of the components.
> 
> Ideally, I would like a way to specify a different set of components for CPack
> and CMake.  Any of the following would suit my particular needs:
> 
> 1) set a variable to specify a single component to be used during "make
> install"
> 2) set a variable to a list of components to be used during "make install"
> 3) Ability to flag an "INSTALL" macro for use in CPack, CMake, or both
> 
> Is there a way to achieve any of the above solutions?

I don't know of a way to control what gets installed by "make install", 
but you can use custom targets to provide your own alternative behaviors 
- for example, I used the following to install debug and release 
versions of a single component (out of many) on a Win32 project where I 
was doing a lot of debugging:

ADD_CUSTOM_TARGET(Install-Foo-Debug
   ${CMAKE_COMMAND}
   -D "BUILD_TYPE=Debug"
   -D "CMAKE_INSTALL_COMPONENT=Foo"
   -D "CMAKE_INSTALL_PREFIX=C:/Program Files/Foo-Debug"
   -P "${Foo_BINARY_DIR}/cmake_install.cmake"
   )

ADD_CUSTOM_TARGET(Install-Foo-Release
   ${CMAKE_COMMAND}
   -D "BUILD_TYPE=Release"
   -D "CMAKE_INSTALL_COMPONENT=Foo"
   -D "CMAKE_INSTALL_PREFIX=C:/Program Files/Foo"
   -P "${Foo_BINARY_DIR}/cmake_install.cmake"
   )

Cheers,
Tim

-- 
Timothy M. Shead
Data Analysis & Visualization (1424)
Sandia National Laboratories
505-284-0139



More information about the CMake mailing list