[CMake] Default values for BUILD_TYPE

Brad King brad.king at kitware.com
Thu Sep 1 17:22:23 EDT 2005


James Bigler wrote:
> It appears that if you don't specify a BUILD_TYPE you get DEBUG.  Can I 
> setup my CMakeLists.txt file to have it default to something else, but 
> allow the user to set it whatever they want?

If you are okay with not letting the user set it to an empty value then 
you can do

IF(NOT CMAKE_BUILD_TYPE)
   SET(CMAKE_BUILD_TYPE "Release" CACHE STRING
       "Choose the type of build, options are: Debug Release 
RelWithDebInfo MinSizeRel."
       FORCE)
ENDIF(NOT CMAKE_BUILD_TYPE)

-Brad


More information about the CMake mailing list