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