[CMake] Depending on a Config File (CMake and VC++)

Brad King brad.king at kitware.com
Fri May 26 13:52:00 EDT 2006


Steve Johns wrote:
>> What is the exact CONFIGURE_FILE call you are using?
> 
> Here it is, cut and pasted:
> 
> IF(CMAKE_CONFIGURATION_TYPES)
>   # Handle multi-configuration generators.
>   FOREACH(config ${CMAKE_CONFIGURATION_TYPES})
>     CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/traps_config.txt,
>                    ${CMAKE_CURRENT_BINARY_DIR}/${config}/traps_config.txt)
>   ENDFOREACH(config)

There was a typo in my example: it should not have the comma between the 
arguments.  The trailing comma is being considered part of the file name!

> ELSE(CMAKE_CONFIGURATION_TYPES)
>   # Handle single-configuration generators.
>   CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/traps_config.txt,
>                  ${CMAKE_CURRENT_BINARY_DIR}/traps_config.txt)
> ENDIF(CMAKE_CONFIGURATION_TYPES)

Be careful with this.  For an in-source build this may not work.  That 
is why my original example included a ".in" extension on the input file.

-Brad


More information about the CMake mailing list