[CMake] Telling whether MSVC is in Debug or Release configuration

Bill Hoffman bill.hoffman at kitware.com
Thu Jan 25 08:29:22 EST 2007


Kedzierski, Artur CIV NAVSURFWARCENDIV CORONA wrote:
>
>         Hi,
>
>         I would like to obtain library name through:
> GET_TARGET_PROPERTY(library_name MyLibraryProject ${CMAKE_ 
> BUILD_TYPE}_LOCATION)
> This works on Linux. However, ${CMAKE_ BUILD_TYPE}  doesn't get set in 
> MSVC.
>         How can I tell whether MSVC is in Debug or Release mode so 
> that I can use it in
> GET_TARGET_PROPERTY?
>
At CMake time, you can't because cmake generates a MSVC project that can 
build more
than one build type.  When the choice is made for which thing is built, 
cmake is no longer running.
There are some variables to help:

CMAKE_CFG_INTDIR  = Debug, Release, etc, at build time.
CMAKE_CONFIGURATION_TYPES = a list of possible build types Debug, 
Release, etc.

-Bill



More information about the CMake mailing list