summaryrefslogtreecommitdiff
path: root/cmake/DefaultBuildType.cmake
blob: 630ecfb8cb29240b35475e8672357ff48a513e1a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Set a default build type if none was specified.

if(CMAKE_BUILD_TYPE OR CMAKE_CONFIGURATION_TYPES)
  return()
endif()

# Default to Release for end user builds (from source archive) and Debug for
# development builds (in a Git repository).
if(CCACHE_DEV_MODE)
  set(
    CMAKE_BUILD_TYPE "Debug"
    CACHE STRING "Choose the type of build." FORCE)
else()
  set(
    CMAKE_BUILD_TYPE "Release"
    CACHE STRING "Choose the type of build." FORCE)
endif()
message(
  STATUS
  "Setting CMAKE_BUILD_TYPE to ${CMAKE_BUILD_TYPE} as none was specified."
)

# Set the possible values of build type for CMake UIs.
set_property(
  CACHE CMAKE_BUILD_TYPE
  PROPERTY
  STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")