Skip to content

Commit 97e8a73

Browse files
authored
Conditional fetch of doctest and fmt in tests (#322)
1 parent 9ed25eb commit 97e8a73

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

tests/CMakeLists.txt

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,24 @@ if(NOT alpaka_FOUND)
3131
FetchContent_MakeAvailable(alpaka)
3232
endif()
3333

34-
# doctest
35-
FetchContent_Declare(
36-
doctest
37-
GIT_REPOSITORY https://github.com/doctest/doctest.git
38-
GIT_TAG dev)
39-
FetchContent_GetProperties(doctest)
40-
if(NOT doctest_POPULATED)
34+
find_package(doctest 2.4.12)
35+
if(NOT doctest_FOUND)
36+
FetchContent_Declare(
37+
doctest
38+
GIT_REPOSITORY https://github.com/doctest/doctest.git
39+
GIT_TAG dev)
4140
FetchContent_MakeAvailable(doctest)
4241
endif()
4342

44-
# fmt
45-
FetchContent_Declare(
46-
fmt
47-
GIT_REPOSITORY https://github.com/fmtlib/fmt.git
48-
GIT_TAG 10.2.1 # or another stable version
49-
)
50-
FetchContent_MakeAvailable(fmt)
43+
find_package(fmt 10.2.1)
44+
if(NOT fmt_FOUND)
45+
FetchContent_Declare(
46+
fmt
47+
GIT_REPOSITORY https://github.com/fmtlib/fmt.git
48+
GIT_TAG 10.2.1 # or another stable version
49+
)
50+
FetchContent_MakeAvailable(fmt)
51+
endif()
5152

5253
option(COVERAGE "Enable code coverage" OFF)
5354

0 commit comments

Comments
 (0)