Skip to content

Commit

Permalink
Default build type setting in preproject.cmake (#1057)
Browse files Browse the repository at this point in the history
  • Loading branch information
achamayou authored Apr 9, 2020
1 parent 84ff0d3 commit b8ddcd0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
16 changes: 0 additions & 16 deletions cmake/common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
17 changes: 17 additions & 0 deletions cmake/preproject.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit b8ddcd0

Please sign in to comment.