[CMake] CMAKE_BUILD_TYPE

Bill Hoffman bill.hoffman at kitware.com
Fri Jan 26 07:16:18 EST 2007


Brandon J. Van Every wrote:
> Bill Hoffman wrote:
>>
>> 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.
>
> I am building with CMake 2.4.6.
>
> With a trivial CMakeLists.txt:
> PROJECT(buildtype)
> MESSAGE("${CMAKE_CONFIGURATION_TYPES}")
> MESSAGE("${CMAKE_BUILD_TYPE}")
> MESSAGE("${CMAKE_CFG_INTDIR}")
>
> under MSYS and MinGW Makefiles generators I get:
> <empty>
> <empty>
> .
>
> under Visual Studio .NET 2003 generator I get:
> Debug;Release;MinSizeRel;RelWithDebInfo
> <empty>
> $(OutDir)
>
>
> So I am not seeing how "Debug" is a default value for CMAKE_BUILD_TYPE.
>
OK, it seems that it is the default for nmake with cl, and for borland, 
but no others and the value is set in the platform file.  Other than 
those two, it is unset....
> Nor do I think it should be.  In Unix-y land, I think most people 
> would want to build release code by default.  When you do a 
> download-compile-install dance, that's certainly what you have in 
> mind.  I do realize that the FSF rams -g down everyone's throats.  
> Many of us aren't able to fathom why the FSF thinks we want to debug 
> their code.  Of course, if they aren't actually interested in what we 
> want, then it all becomes clear.
>
>>
>> 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)
>
>
> I guess I could tell whether the generator is single directory or 
> multiple directory, based on whether CMAKE_CONFIGURATION_TYPES is 
> non-empty.
>
Yes, that is what I do.

-Bill



More information about the CMake mailing list