forked from zeus-cpp/expected
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
41 lines (32 loc) · 1 KB
/
Copy pathCMakeLists.txt
File metadata and controls
41 lines (32 loc) · 1 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
34
35
36
37
38
39
40
41
project(test_expected LANGUAGES CXX)
set(SOURCES
base_tests.cpp
monadic_tests.cpp
noexcept_tests.cpp
equality_tests.cpp
lwg_3886_tests.cpp
lwg_4031_tests.cpp
)
find_package(Catch2 3 REQUIRED)
include(Catch)
function(add_test_expected CPP_STANDARD)
set(TARGET_NAME ${PROJECT_NAME}_cpp${CPP_STANDARD})
add_executable(${TARGET_NAME})
set_target_properties(${TARGET_NAME}
PROPERTIES CXX_STANDARD ${CPP_STANDARD})
# The two targets belong to different scopes,
# so linking them separately is better for clarity.
target_link_libraries(${TARGET_NAME}
PRIVATE Catch2::Catch2WithMain)
target_link_libraries(${TARGET_NAME}
PRIVATE zeus::expected)
target_sources(${TARGET_NAME} PRIVATE ${SOURCES})
catch_discover_tests(${TARGET_NAME})
endfunction()
add_test_expected(17)
if (cxx_std_20 IN_LIST CMAKE_CXX_COMPILE_FEATURES)
add_test_expected(20)
endif ()
if (cxx_std_23 IN_LIST CMAKE_CXX_COMPILE_FEATURES)
add_test_expected(23)
endif ()