From 04a6da0cb586cc90e0c97e08f9d87fe2a6379bfb Mon Sep 17 00:00:00 2001 From: Andre Sailer Date: Mon, 21 Aug 2023 15:43:32 +0200 Subject: [PATCH] Tests: require newer catch2 version when using c++20, get latest catch2 v3 version for internal --- tests/unittests/CMakeLists.txt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/unittests/CMakeLists.txt b/tests/unittests/CMakeLists.txt index 04f1e019a..5d938ef6a 100644 --- a/tests/unittests/CMakeLists.txt +++ b/tests/unittests/CMakeLists.txt @@ -1,8 +1,13 @@ +if(CMAKE_CXX_STANDARD GREATER_EQUAL 20) + set(CATCH2_MIN_VERSION 3.4) +else() + set(CATCH2_MIN_VERSION 3.1) +endif() if(USE_EXTERNAL_CATCH2) if (USE_EXTERNAL_CATCH2 STREQUAL AUTO) - find_package(Catch2 3.1) + find_package(Catch2 ${CATCH2_MIN_VERSION}) else() - find_package(Catch2 3.1 REQUIRED) + find_package(Catch2 ${CATCH2_MIN_VERSION} REQUIRED) endif() endif() @@ -16,7 +21,7 @@ if(NOT Catch2_FOUND) FetchContent_Declare( Catch2 GIT_REPOSITORY https://github.com/catchorg/Catch2.git - GIT_TAG v3.1.0 + GIT_TAG v3.4.0 ) FetchContent_MakeAvailable(Catch2) set(CMAKE_MODULE_PATH ${Catch2_SOURCE_DIR}/extras ${CMAKE_MODULE_PATH})