[CMake] Default value for CMAKE_BUILD_TYPE

pellegrini pellegrini at ill.fr
Fri May 11 11:21:24 EDT 2012


Hi all,

when cmake is run without specifying the build type using -D 
CMAKE_BUILD_TYPE, it is the Debug mode that is selected as
the default. I would like to find a way to use Release as the default 
value when the user does not specify any build
type in the cmake command line.

 From one of my previous post concerning CMAKE_INSTALL_PREFIX variable, 
I was thinking to use a similar approach i.e.:

project(Foo)

if (CMAKE_BUILD_TYPE_INITIALIZED_TO_DEFAULT)
     set(CMAKE_BUILD_TYPE Release)
endif

but cmake still sets CMAKE_BUILD_TYPE to Debug in the CMakeCache.txt file.

Would you have any idea about what is wrong with my implementation ?

thanks a lot.

Eric


More information about the CMake mailing list