From: Kefu Chai Date: Fri, 12 Mar 2021 11:29:54 +0000 (+0800) Subject: cmake: make "WITH_CEPH_DEBUG_MUTEX" depend on CMAKE_BUILD_TYPE X-Git-Tag: v17.1.0~2626^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=403f1ec2888a495fd3e40abbdb10c82793e22521;p=ceph.git cmake: make "WITH_CEPH_DEBUG_MUTEX" depend on CMAKE_BUILD_TYPE this option is available only if CMAKE_BUILD_TYPE is Debug. this change helps us to unify the checks for WITH_CEPH_DEBUG_MUTEX, without this change, we always have to check both WITH_CEPH_DEBUG_MUTEX *and* CMAKE_BUILD_TYPE. after this change, we only respect WITH_CEPH_DEBUG_MUTEX. Signed-off-by: Kefu Chai --- diff --git a/CMakeLists.txt b/CMakeLists.txt index e41dc43bb543..f3512d60ce4e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -320,7 +320,8 @@ if(WITH_LZ4) set(HAVE_LZ4 ${LZ4_FOUND}) endif(WITH_LZ4) -option(WITH_CEPH_DEBUG_MUTEX "Use debug ceph::mutex with lockdep" OFF) +CMAKE_DEPENDENT_OPTION(WITH_CEPH_DEBUG_MUTEX "Use debug ceph::mutex with lockdep" ON + "CMAKE_BUILD_TYPE STREQUAL Debug" OFF) #if allocator is set on command line make sure it matches below strings set(ALLOCATOR "" CACHE STRING diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1b45100eac8f..fe93590cb4c5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -113,7 +113,7 @@ if(NOT CMAKE_BUILD_TYPE) 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) +if(WITH_CEPH_DEBUG_MUTEX) add_compile_options($<$:-DCEPH_DEBUG_MUTEX>) endif()