diff --git a/cmake/common.cmake b/cmake/common.cmake index c982e211624..78ae02faa34 100644 --- a/cmake/common.cmake +++ b/cmake/common.cmake @@ -3,22 +3,6 @@ set(CMAKE_MODULE_PATH "${CCF_DIR}/cmake;${CMAKE_MODULE_PATH}") -set(default_build_type "RelWithDebInfo") -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" - ) -endif() - set(CMAKE_EXPORT_COMPILE_COMMANDS ON) find_package(Threads REQUIRED) diff --git a/cmake/preproject.cmake b/cmake/preproject.cmake index 368577b6e05..8e8ab916a10 100644 --- a/cmake/preproject.cmake +++ b/cmake/preproject.cmake @@ -36,4 +36,21 @@ if(CMAKE_C_COMPILER_ID MATCHES "Clang") endif() endif() +# Build Release by default, with debug info +set(default_build_type "RelWithDebInfo") +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" + ) +endif() + set(CMAKE_CXX_STANDARD 17)