Fix Catch2 build break on Debian 12

This commit is contained in:
Robin E. R. Davies
2026-06-17 10:35:57 -04:00
parent f836ed5f98
commit 859500a8ac
+10 -4
View File
@@ -24,12 +24,12 @@ find_package(PkgConfig REQUIRED)
find_package(Catch2 QUIET)
# Catch2 v3 (Arch, newer distros) uses multi-headers under <catch2/>.
# Catch2 v2 (Debian/Ubuntu) provides a single catch.hpp at system level.
# Catch2 Arch and Debian13 provide catch2 v3, with multi-headers under catch2
# Catch2 Debian12 provides catch2 v2, with a single header.
# When Catch2 v3 is found via CMake, generate compatibility wrappers so
# old-style #include "catch.hpp" and #include <catch/catch.hpp> still work.
if(Catch2_FOUND)
# Generate catch.hpp wrapper in the build directory.
if(Catch2_VERSION VERSION_GREATER_EQUAL "3.0.0") # Generate catch.hpp wrapper in the build directory.
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/catch.hpp"
"#pragma once\n"
"#include <catch2/catch_all.hpp>\n"
@@ -44,8 +44,14 @@ if(Catch2_FOUND)
# can find the compatibility wrappers.
include_directories(${CMAKE_CURRENT_BINARY_DIR})
message(STATUS "Catch2 v3 found. Generated compatibility wrappers in ${CMAKE_CURRENT_BINARY_DIR}")
elseif(Catch2_VERSION VERSION_GREATER_EQUAL "2.0.0") # Generate catch.hpp wrapper in the build directory.
# Just use the system version directly.
message(STATUS "Catch2 v2 found. Using system catch2/catch.hpp directly.")
else()
message(STATUS "Catch2 CMake package not found. Expecting system catch.hpp (Catch2 v2 style).")
message(ERROR "Catch2: Unsupported Catch2 version: ${Catch2_VERSION}. Expecting Catch2 v2 or v3.")
endif()
else()
message(ERROR "Catch2 CMake package not found. Expecting system catch.hpp (Catch2 v2 style).")
endif()
pkg_check_modules(PipeWire REQUIRED libpipewire-0.3)