From 52e420b0be29a170cb8a4bfc1693c543b293f525 Mon Sep 17 00:00:00 2001 From: Ulrich Mohr Date: Fri, 18 Feb 2022 11:37:32 +0100 Subject: [PATCH] tweaked build of catch2 -only built when needed -no more warnings as catch2 is compiled with default compiler flags --- CMakeLists.txt | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c160fe5..32bf2324 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -139,20 +139,6 @@ set(FSFW_ADDITIONAL_INC_PATHS # Check whether the user has already installed Catch2 first find_package(Catch2 3) -# Not installed, so use FetchContent to download and provide Catch2 -if(NOT Catch2_FOUND) - include(FetchContent) - - FetchContent_Declare( - Catch2 - GIT_REPOSITORY https://github.com/catchorg/Catch2.git - GIT_TAG v3.0.0-preview4 - ) - - FetchContent_MakeAvailable(Catch2) - #fixes regression -preview4, to be confirmed in later releases - set_target_properties(Catch2 PROPERTIES DEBUG_POSTFIX "") -endif() ################################################################################ # Executable and Sources @@ -182,6 +168,24 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") set(COMPILER_FLAGS "/permissive-") endif() +# Not installed, so use FetchContent to download and provide Catch2 +if(NOT Catch2_FOUND) + include(FetchContent) + + FetchContent_Declare( + Catch2 + GIT_REPOSITORY https://github.com/catchorg/Catch2.git + GIT_TAG v3.0.0-preview4 + ) + + FetchContent_MakeAvailable(Catch2) + #fixes regression -preview4, to be confirmed in later releases + set_target_properties(Catch2 PROPERTIES DEBUG_POSTFIX "") + set_target_properties(Catch2 PROPERTIES EXCLUDE_FROM_ALL "true") + set_target_properties(Catch2WithMain PROPERTIES EXCLUDE_FROM_ALL "true") +endif() + + add_library(${LIB_EIVE_MISSION})