-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
33 lines (31 loc) · 1.3 KB
/
CMakeLists.txt
File metadata and controls
33 lines (31 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
find_package(doctest 2.4.8 CONFIG)
if(doctest_FOUND)
find_path(DOCTEST_INCLUDE_DIR NAMES doctest/doctest.h PATH_SUFFIXES include)
add_library(doctest INTERFACE)
target_include_directories(doctest INTERFACE "${DOCTEST_INCLUDE_DIR}/doctest")
elseif(EXISTS /opt/doctest_proj_2.4.8)
set(DOCTEST_INCLUDE_DIR "/opt/doctest_proj_2.4.8/doctest" CACHE INTERNAL "Path to include folder for doctest")
add_library(doctest INTERFACE)
add_dependencies(doctest doctest_proj)
target_include_directories(doctest INTERFACE "${DOCTEST_INCLUDE_DIR}")
else()
# Download doctest repo.
include(ExternalProject)
find_package(Git REQUIRED)
ExternalProject_Add(
doctest_proj
PREFIX ${CMAKE_BINARY_DIR}/doctest
GIT_REPOSITORY https://github.com/onqtam/doctest.git
GIT_TAG 7b9885133108ae301ddd16e2651320f54cafeba7 # v2.4.8
TIMEOUT 10
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
LOG_DOWNLOAD ON
)
ExternalProject_Get_Property(doctest_proj source_dir)
set(DOCTEST_INCLUDE_DIR "${source_dir}/doctest" CACHE INTERNAL "Path to include folder for doctest")
add_library(doctest INTERFACE)
add_dependencies(doctest doctest_proj)
target_include_directories(doctest INTERFACE "${DOCTEST_INCLUDE_DIR}")
endif()