]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: disable Catch2 tests when Catch2 is unavailable 69374/head
authorSun Yuechi <sunyuechi@iscas.ac.cn>
Wed, 10 Jun 2026 00:13:53 +0000 (08:13 +0800)
committerSun Yuechi <sunyuechi@iscas.ac.cn>
Wed, 10 Jun 2026 00:17:59 +0000 (08:17 +0800)
debhelper on noble passes -DFETCHCONTENT_FULLY_DISCONNECTED=ON, so CPM
cannot fetch Catch2 and silently skips it, leaving no Catch2 targets
behind and breaking the generate step. Fall back to WITH_CATCH2=OFF
with a warning instead.

Signed-off-by: Sun Yuechi <sunyuechi@iscas.ac.cn>
CMakeLists.txt

index 8aefd36e16b93eff0a68e2dda34f6098c432e351..46a0efc680d15dd8a6c062bdde61bef139846c41 100644 (file)
@@ -545,7 +545,14 @@ if(WITH_CATCH2)
   # Restore the original CPM settings in case someone else wants to use the module:
   set(CPM_USE_LOCAL_PACKAGES_ONLY, ${ORIG_CPM_USE_LOCAL_PACKAGES_ONLY})
 
-  message("-- Enabled Catch2 support")
+  # CPM skips the fetch silently if downloads are disabled,
+  # e.g. with FETCHCONTENT_FULLY_DISCONNECTED=ON on deb builds
+  if(NOT TARGET Catch2::Catch2WithMain)
+    message(WARNING "Catch2 unavailable, disabling Catch2 tests")
+    set(WITH_CATCH2 OFF)
+  else()
+    message("-- Enabled Catch2 support")
+  endif()
 endif()
 
 # enable breakpad unless win32 or power