From 310a9590231ac13f44a2a20664a2502c378780f5 Mon Sep 17 00:00:00 2001 From: Brad Hubbard Date: Wed, 9 Oct 2019 11:52:33 +1000 Subject: [PATCH] cmake: Do a debug build by default Signed-off-by: Brad Hubbard --- src/CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 60e261b10e6..9a0036d1f72 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -74,7 +74,13 @@ endif(CMAKE_CXX_COMPILER_ID STREQUAL GNU) set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS}") if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Default BUILD_TYPE is RelWithDebInfo, other options are: Debug, Release, and MinSizeRel." FORCE) + if(EXISTS "${CMAKE_SOURCE_DIR}/.git") + set(default_build_type "Debug") + else() + set(default_build_type "RelWithDebInfo") + endif() + set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE + STRING "Default BUILD_TYPE is Debug, other options are: RelWithDebInfo, Release, and MinSizeRel." FORCE) endif() if(WITH_CEPH_DEBUG_MUTEX OR CMAKE_BUILD_TYPE STREQUAL Debug) -- 2.39.5