Bump version for release
[quassel.git] / cmake / BuildType.cmake
1 # Derived from Marcus D. Hanwell's suggestion
2 # https://blog.kitware.com/cmake-and-the-default-build-type/
3
4 # Set a default build type if none was specified
5 set(default_build_type "Release")
6
7 # For builds from Git, default to Debug
8 if (EXISTS "${CMAKE_SOURCE_DIR}/.git")
9     set(default_build_type "Debug")
10 endif()
11
12 # Multi-config generators (such as the VS one) will set the config types
13 if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
14     message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
15     set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
16         STRING "Choose the type of build." FORCE)
17     # Set the possible values of build type for cmake-gui
18     set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
19 else()
20     message(STATUS "CMake build type: ${CMAKE_BUILD_TYPE}")
21 endif()