[CMake] CMAKE_BUILD_TYPE

Bill Hoffman bill.hoffman at kitware.com
Thu Jan 25 14:50:54 EST 2007


Brandon J. Van Every wrote:
> I added the following notation to the Useful Variables page of the wiki:
> http://www.cmake.org/Wiki/CMake_Useful_Variables#Compilers_and_Tools
>
> "Note that CMAKE_BUILD_TYPE is not initialized with a readable value 
> at configuration time. This is because the user is free to select a 
> build type at build time. Use CMAKE_CFG_INTDIR if you need a variable 
> that evalulates to the correct buld time directory."
>
> I am wondering if this behavior should be considered a bug.  Even if 
> not, it's definitely inconsistent with user expectations.  I'm not 
> sure my documentation above is wholly correct, but it's a 1st stab at 
> alleviating confusion.
I am not sure the wiki is exactly correct....

Basically, there are two types of generators, single build type per 
build tree, and multi- build type per tree.  The variables that are 
useful for that are here:

CMAKE_BUILD_TYPE is used by makefile generators or any future generator 
that supports one build type per build tree.  The default value is now 
Debug.

CMAKE_CFG_INTDIR is set by generators like MSVC IDE and Xcode that 
support building more than one build type per build tree.  

CMAKE_CONFIGURATION_TYPES is set to the list of available build types 
for the current generator (empty for makefiles, and Debug, Release, etc 
for IDE)

-Bill




More information about the CMake mailing list