]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: make "WITH_CEPH_DEBUG_MUTEX" depend on CMAKE_BUILD_TYPE
authorKefu Chai <kchai@redhat.com>
Fri, 12 Mar 2021 11:29:54 +0000 (19:29 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 12 Mar 2021 13:00:19 +0000 (21:00 +0800)
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 <kchai@redhat.com>
CMakeLists.txt
src/CMakeLists.txt

index e41dc43bb5434d757093992cf43d6c3dbf74d451..f3512d60ce4efddff4ef387cde544e1deed67f0a 100644 (file)
@@ -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
index 1b45100eac8f85ad025244558ec2e1f7e7af5ac5..fe93590cb4c5058480dec87504d4c1b01296ad93 100644 (file)
@@ -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($<$<COMPILE_LANGUAGE:CXX>:-DCEPH_DEBUG_MUTEX>)
 endif()