From 4a7ac0060116ec1eb49e5e803d1e174be388522e Mon Sep 17 00:00:00 2001 From: Sun Yuechi Date: Wed, 10 Jun 2026 08:13:53 +0800 Subject: [PATCH] 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 --- CMakeLists.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 -- 2.47.3