summaryrefslogtreecommitdiff
path: root/BuildType.cmake
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-09-08 15:32:30 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-09-08 15:32:30 +0300
commit1d1229b48ce48688cca5fe926b4875b0c138bc5c (patch)
tree4a2e38ae42b127eb3eb4fba1a07f179496e0c2d2 /BuildType.cmake
parenta288eb43ed772f7aff5500ca5fc9ba545ab341c4 (diff)
Default build type selection
Diffstat (limited to 'BuildType.cmake')
-rw-r--r--BuildType.cmake19
1 files changed, 19 insertions, 0 deletions
diff --git a/BuildType.cmake b/BuildType.cmake
new file mode 100644
index 00000000..ef031eac
--- /dev/null
+++ b/BuildType.cmake
@@ -0,0 +1,19 @@
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