[CMake] Set default build type in CMakeLists.txt

Tyler Roscoe tyler at cryptio.net
Mon Jun 22 11:54:56 EDT 2009


On Mon, Jun 22, 2009 at 11:42:34AM -0400, David Doria wrote:
> I thought I could set the default build type with the following:
> 
> SET(CMAKE_BUILD_TYPE debug)
> PROJECT(Test)
> ADD_EXECUTABLE(Test Test.cpp)
> 
> However, when I run ccmake and then press 'c', the CMAKE_BUILD_TYPE field is
> still empty. Is it set and just not showing up? Or has it not been set
> properly?

You need to use the form set(... CACHE ...) if you want that value to
appear in the cache. Look at the docs for set().

tyler


More information about the CMake mailing list