]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: guard unittest_global_doublefree with WITH_LIBCEPHFS 66848/head
authorKefu Chai <k.chai@proxmox.com>
Thu, 8 Jan 2026 23:43:13 +0000 (07:43 +0800)
committerKefu Chai <k.chai@proxmox.com>
Fri, 9 Jan 2026 04:53:41 +0000 (12:53 +0800)
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 <k.chai@proxmox.com>
src/test/common/CMakeLists.txt

index 7624abf2deeb623854721697d4ac762308613f33..50ebf9166c123d062356b57f44639535bb84fa39 100644 (file)
@@ -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