[CMake] What is the default build type?

Michael Ellery mellery451 at gmail.com
Tue Aug 1 00:28:59 EDT 2017



> On Jul 31, 2017, at 8:48 PM, Florian Lindner <mailinglists at xgm.de> wrote:
> 
> Hello
> 
> ccmake shows CMAKE_BUILD_TYPE as unset. From the compile commands it looks like also nothing like Debug nor Release.
> 
> Why is there no well-defined default set? How can I set a default?
> 
> Thanks,
> Florian
> -- 
> 
> Powered by www.kitware.com
> 
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
> 
> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
> 
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake


my recollection is that an unspecified build type results in a build that has no optimizations and no debug symbols generated. I’m not sure what the motivation for those default flags is. If you want to default to DEBUG, something like this should work:

    if (NOT CMAKE_BUILD_TYPE)
      set(CMAKE_BUILD_TYPE Debug)
    endif()


-MIke



More information about the CMake mailing list