[CMake] CMAKE_BUILD_TYPE

Brandon J. Van Every bvanevery at gmail.com
Fri Jan 26 02:24:49 EST 2007


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.

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.


Cheers,
Brandon Van Every



More information about the CMake mailing list