-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathCMakeLists.txt
84 lines (69 loc) · 2.03 KB
/
CMakeLists.txt
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
cmake_minimum_required(VERSION 3.3)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
include(HunterGate)
HunterGate(
URL "https://github.com/ruslo/hunter/archive/v0.23.66.tar.gz"
SHA1 "c599029cf00b124c624702739741fead5d4e605d"
)
project(GreenTiger)
set(BOOST_COMPONENTS system filesystem)
hunter_add_package(Boost COMPONENTS ${BOOST_COMPONENTS})
find_package(Boost CONFIG REQUIRED ${BOOST_COMPONENTS})
hunter_add_package(Catch)
find_package(Catch2 CONFIG REQUIRED)
hunter_add_package(range-v3)
find_package(range-v3 CONFIG REQUIRED)
hunter_add_package(Microsoft.GSL)
find_package(Microsoft.GSL CONFIG REQUIRED)
hunter_add_package(type_safe)
find_package(type_safe CONFIG REQUIRED)
include(CompilerWarnings)
option(BUILD_TESTS "Build tests" ON)
if(BUILD_TESTS)
enable_testing()
option(POST_BUILD_TESTS "Run tests on each target's post build step" TRUE)
function(parse_unit_tests target)
include(CatchDiscoverTests)
cmake_parse_arguments(
"TEST"
""
""
"ARCHS"
${ARGN}
)
# abort on first failure
if(TEST_ARCHS)
foreach(ARCH ${TEST_ARCHS})
catch_discover_tests(${target}
EXTRA_ARGS -a -w NoAssertions --arch ${ARCH}
PROPERTIES LABELS ${target}
)
endforeach()
else()
catch_discover_tests(${target}
EXTRA_ARGS -a -w NoAssertions
PROPERTIES LABELS ${target}
)
endif()
if (POST_BUILD_TESTS)
add_custom_command(TARGET ${target}
POST_BUILD
COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG> -L ${target} --output-on-failure -j8 ${TEST_UNPARSED_ARGUMENTS}
COMMENT "Running ${target} unit tests")
endif()
endfunction()
else()
function(parse_unit_tests)
endfunction()
endif()
add_subdirectory(include)
add_subdirectory(Chapter01)
add_subdirectory(Chapter02)
add_subdirectory(Chapter03)
add_subdirectory(Chapter04)
add_subdirectory(Chapter05)
add_subdirectory(Chapter06)
add_subdirectory(Chapter07)
add_subdirectory(Chapter08)
add_subdirectory(Chapter09)
add_subdirectory(Chapter10)