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

Zachary Pincus zpincus at stanford.edu
Tue Jan 17 14:25:48 EST 2006


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?

Thanks,

Zach



On Jan 17, 2006, at 6:10 AM, William A. Hoffman wrote:

> At 03:55 AM 1/17/2006, Zachary Pincus wrote:
>> Hi Folks,
>>
>> Is the CMAKE_CONFIGURATION_TYPES flag and the associated logic still
>> in use, or has it been deprecated in favor of some other build- 
>> type- selection mechanism? I can find precious little information  
>> about
>> this online.
>>
>> I'm working on a cmake-driven project which I would like to be as
>> general as possible. There are some mentions in the existing
>> CMakeLists code of CMAKE_CONFIGURATION_TYPES and CMAKE_CFG_INTDIR,
>> but I can't tell if these are relics or codepaths that would still be
>> actively used under certain circumstances.
>>
>> If this mechanism is used, could someone answer some questions about
>> how to formulate a CMakeLists to make use of it? Specifically, I can
>> imagine two possible ways this variable could be used by CMake:
>>
>> (1) The CMakeLists must manually loop over each configuration in
>> CMAKE_CONFIGURATION_TYPES to do some manual file additions or  
>> whatnot.
>> Sample usage under this model:
>>    FOREACH(config ${CMAKE_CONFIGURATION_TYPES})
>>      SET(FOO "${BINARY_DIR}/${config}")
>>      CONFIGURE_FILE(${FILE} ${OUTFILE} IMMEDIATE)
>>    ENDFOREACH(config)
>>
>> (2) CMake implicitly re-runs the CMakeLists for each separate
>> configuration type, setting CMAKE_CFG_INTDIR differently for each.
>> E.g.:
>>    SET(FOO "${BINARY_DIR}/${CMAKE_CFG_INTDIR}")
>>    CONFIGURE_FILE(${FILE} ${OUTFILE} IMMEDIATE)
>> and that code will get run by CMake one time for each configuration
>> type.
>>
>> Are either of these really the case? If CMAKE_CONFIGURATION_TYPES
>> should still be used, in what manner should they be handled?
>
>
>
> Yes, they are still in use.
>
> For build tools that support configuration types,  
> CMAKE_CONFIGURATION_TYPES
> will be set to the available configurations.  Currently, Xcode 2.X,  
> and
> all visual studio IDE builds have this variable.   The makefiles  
> generators
> do not set this variable.
>
> CMAKE_CFG_INTDIR is set to "." for makefiles, and it is set to a  
> variable
> that can be expanded at build time.   It is meant for
> use in custom commands and targets.   It can not be used in  
> configure file.
> For example, if you want to run an executable that you just built in
> a custom command you would use CMAKE_CFG_INTDIR as part of the path.
> bin/${CMAKE_CFG_INTDIR}/myprogram, with makefiles this would expand to
> bin/./myprogram, and in a visual studio project it would expand to
> bin/$(INTDIR)/myprogram, and for Xcode it will be bin/$ 
> (CONFIGURATION)/myprogram.
>
> Generally, CMAKE_CONFIGURATION_TYPES  is used to pre-create files  
> that are needed
> for each possible build type, like you have in usage 1.
>
> Your usage 2, will not do anything useful.
>
> -Bill
>
>



More information about the CMake mailing list