From: Sun Yuechi Date: Wed, 10 Jun 2026 00:13:53 +0000 (+0800) Subject: cmake: disable Catch2 tests when Catch2 is unavailable X-Git-Tag: v21.0.1~12^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F69374%2Fhead;p=ceph.git cmake: disable Catch2 tests when Catch2 is unavailable 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 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 8aefd36e16b..46a0efc680d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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