[CMake] CMAKE_CONFIGURATION_TYPES -- still in use? How to use?

Brad King brad.king at kitware.com
Thu Jan 26 13:18:08 EST 2006


Zachary Pincus wrote:
> Thanks for the explanation of the configuration types system.
> 
> How does this interact with files installed with INSTALL_FILES(...)?
> 
> Specifically, do I need to issue a separate INSTALL_FILES command for  
> each configuration type (assuming that the files are placed  differently 
> depending on the same)? Or will a command like:
> INSTALL_FILES(${install_dir} FILES ${whatever}/${CMAKE_CFG_INTDIR}/ 
> source.c)
> work properly because it is a 'build-time' command?

The configuration installed is determined by the configuration specified
when building the "INSTALL" or "install" target in the build system.
Targets are handled automatically, but for per-configuration files you
have to take advantage of the definition "BUILD_TYPE" that will be
available to the cmake_install.cmake scripts at install time.  For example:

IF(CMAKE_CONFIGURATION_TYPES)
   # ... create the per-config files ...
   SET(inst_from_dir ${whatever}/\${BUILD_TYPE})
ELSE(CMAKE_CONFIGURATION_TYPES)
   # ... create the one-config files ...
   SET(inst_from_dir ${whatever})
ENDIF(CMAKE_CONFIGURATION_TYPES)

INSTALL_FILES(${install_dir} FILES ${inst_from_dir}/foo.cxx)

-Brad


More information about the CMake mailing list