diff options
author | Albert Astals Cid <albert.astals.cid@kdab.com> | 2019-02-19 16:38:11 +0100 |
---|---|---|
committer | Albert Astals Cid <albert.astals.cid@kdab.com> | 2019-02-21 13:51:05 +0000 |
commit | 632d014afd5a3c1a40fc67cf0fc78d8c80d3da8f (patch) | |
tree | 821242bb0b00b688900e1d787ad633bc00cfe676 /cmake/QtSetup.cmake | |
parent | b88110a3d7f795e91bff4ed73bd680ad8a364be0 (diff) |
cmake: set a CMAKE_BUILD_TYPE if none was specified
Because the default "empty" CMAKE_BUILD_TYPE is a weird default
Change-Id: I5768f67aa85dce4108e421d2f4eacdfb1cb5beb0
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Diffstat (limited to 'cmake/QtSetup.cmake')
-rw-r--r-- | cmake/QtSetup.cmake | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/cmake/QtSetup.cmake b/cmake/QtSetup.cmake index 6fd2b2d923..a90f12d0c2 100644 --- a/cmake/QtSetup.cmake +++ b/cmake/QtSetup.cmake @@ -1,3 +1,15 @@ +## Set a default build type if none was specified +set(_default_build_type "Release") +if(EXISTS "${CMAKE_SOURCE_DIR}/.git") + set(_default_build_type "Debug") +endif() + +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS "Setting build type to '${_default_build_type}' as none was specified.") + set(CMAKE_BUILD_TYPE "${_default_build_type}" CACHE STRING "Choose the type of build." FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") # Set the possible values of build type for cmake-gui +endif() + ## Force C++ standard, do not fall back, do not use compiler extensions set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) |