From 985c9607f66c08c032394a8ae0aa3f7968da5b44 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Fri, 9 Jan 2026 07:43:13 +0800 Subject: [PATCH] cmake: guard unittest_global_doublefree with WITH_LIBCEPHFS The unittest_global_doublefree test detects double-free issues in global static variables when an executable links both librados and libcephfs. However, it was incorrectly guarded by WITH_CEPHFS (which controls the server-side cephfs components) instead of WITH_LIBCEPHFS (which controls the client library it actually depends on). This causes build failures when building with WITH_LIBCEPHFS enabled but WITH_CEPHFS disabled: ``` /usr/bin/ld: cannot find -lcephfs: No such file or directory ``` Change the guard to WITH_LIBCEPHFS to match the actual dependency. While this scenario is uncommon (most users enable WITH_CEPHFS), the fix correctly aligns the build logic with the test's dependencies. Signed-off-by: Kefu Chai --- src/test/common/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/common/CMakeLists.txt b/src/test/common/CMakeLists.txt index 7624abf2deeb6..50ebf9166c123 100644 --- a/src/test/common/CMakeLists.txt +++ b/src/test/common/CMakeLists.txt @@ -316,13 +316,13 @@ add_ceph_unittest(unittest_perf_counters_key) target_link_libraries(unittest_perf_counters_key ceph-common) # unittest_global_doublefree -if(WITH_CEPHFS) +if(WITH_LIBCEPHFS) add_executable(unittest_global_doublefree test_global_doublefree.cc ) add_ceph_unittest(unittest_global_doublefree) target_link_libraries(unittest_global_doublefree cephfs librados ceph-common) -endif(WITH_CEPHFS) +endif() if(NOT WIN32) add_executable(unittest_dns_resolve -- 2.47.3