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 <kchai@redhat.com>
This commit is contained in:
Kefu Chai 2021-03-12 19:29:54 +08:00
parent fcdc229175
commit 403f1ec288
2 changed files with 3 additions and 2 deletions

View 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

View 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()