Skip to content

Commit

Permalink
Change the default based on being a git clone
Browse files Browse the repository at this point in the history
This does what had been done by hand in the past, check for .git in the
source directory, if present keep the default as Debug otherwise switch
it to Release.

Signed-off-by: Marcus D. Hanwell <mhanwell@bnl.gov>
  • Loading branch information
cryos committed May 9, 2023
1 parent b54aa28 commit 0d9d607
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions cmake/BuildType.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# Set a default build type if none was specified
set(_build_type "Release")
if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
set(_build_type "Debug")
endif()
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to 'Debug' as none was specified.")
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build." FORCE)
message(STATUS "Setting build type to '${_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE ${_build_type}
CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
"MinSizeRel" "RelWithDebInfo" "ASAN" "TSAN" "MSAN" "LSAN" "UBSAN")
Expand Down

0 comments on commit 0d9d607

Please sign in to comment.