From 3d80b7e02a6c17dac8951cc6474e0856db3bb802 Mon Sep 17 00:00:00 2001 From: Max Luebke Date: Wed, 19 Jul 2023 11:31:59 +0200 Subject: [PATCH] build: only fetch doctest if it is not present yet --- test/CMakeLists.txt | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 1096dd3..ed46443 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,17 +1,20 @@ -include(FetchContent) +find_library(DOCTEST_LIB doctest) -FetchContent_Declare( +if(NOT DOCTEST_LIB) + include(FetchContent) + + FetchContent_Declare( DocTest GIT_REPOSITORY https://github.com/doctest/doctest.git - GIT_TAG v2.4.9 -) + GIT_TAG v2.4.9) -FetchContent_MakeAvailable(DocTest) + FetchContent_MakeAvailable(DocTest) +endif() add_executable(testTug setup.cpp testBoundaryCondition.cpp testDiffusion.cpp) target_link_libraries(testTug doctest tug) -add_custom_target(check - COMMAND $ - DEPENDS testTug -) +add_custom_target( + check + COMMAND $ + DEPENDS testTug)