[CMake] CMAKE_CONFIGURATION_TYPES -- still in use? How to use?
Zachary Pincus
zpincus at stanford.edu
Thu Jan 26 14:04:32 EST 2006
Let me recap to make sure I've got it:
*Configure time* operations (e.g. WRITE_FILE, say) must place
configuration-specific build files in every location specified by
CMAKE_CONFIGURATION_TYPES, because the build-time config is unknown,
or may change.
*Build time* operations must use the CMAKE_CFG_INTDIR variable to
select a file from the current build directory. This variable expands
to something like $(config) which is intelligible to the IDE running
the build.
*Install time* operations must use the BUILD_TYPE variable
(carefully, so it isn't expanded until install time) which contains
the proper build path. Since install is managed by cmake, and not
some IDE, the CMAKE_CFG_INTDIR variable isn't useful because "$
(config)" or similar is meaningless to cmake.
Is this all correct (if vaguely confusing)?
Zach
On Jan 26, 2006, at 10:18 AM, Brad King wrote:
> 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