BuildType.cmake 648 B

123456789101112131415161718192021
  1. # Set a default build type if none was specified
  2. set(default_build_type "Release")
  3. if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
  4. set(default_build_type "Debug")
  5. endif()
  6. if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
  7. message(
  8. STATUS
  9. "Setting build type to '${default_build_type}' as none was specified."
  10. )
  11. set(CMAKE_BUILD_TYPE
  12. "${default_build_type}"
  13. CACHE STRING "Choose the type of build." FORCE
  14. )
  15. # Set the possible values of build type for cmake-gui
  16. set_property(
  17. CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel"
  18. "RelWithDebInfo"
  19. )
  20. endif()