blob: 292dac9a6d85efd1e4cdb629ec7309fdfd588678 (
plain)
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
|
cmake_minimum_required(VERSION 3.16)
project(Catch3Examples LANGUAGES CXX)
message(STATUS "Examples included")
# Some one-offs first:
# 1) Tests and main in one file
add_executable(010-TestCase
010-TestCase.cpp
)
# 2) Tests and main across two files
add_executable(020-MultiFile
020-TestCase-1.cpp
020-TestCase-2.cpp
)
add_executable(231-Cfg_OutputStreams
231-Cfg-OutputStreams.cpp
)
target_link_libraries(231-Cfg_OutputStreams Catch3_buildall_interface)
target_compile_definitions(231-Cfg_OutputStreams PUBLIC CATCH_CONFIG_NOSTDOUT)
# These examples use the standard separate compilation
set(SOURCES_IDIOMATIC_EXAMPLES
030-Asn-Require-Check.cpp
100-Fix-Section.cpp
110-Fix-ClassFixture.cpp
111-Fix-PersistentFixture.cpp
120-Bdd-ScenarioGivenWhenThen.cpp
210-Evt-EventListeners.cpp
232-Cfg-CustomMain.cpp
300-Gen-OwnGenerator.cpp
301-Gen-MapTypeConversion.cpp
302-Gen-Table.cpp
310-Gen-VariablesInGenerators.cpp
311-Gen-CustomCapture.cpp
)
string(REPLACE ".cpp" "" BASENAMES_IDIOMATIC_EXAMPLES "${SOURCES_IDIOMATIC_EXAMPLES}")
set(TARGETS_IDIOMATIC_EXAMPLES ${BASENAMES_IDIOMATIC_EXAMPLES})
foreach(name ${TARGETS_IDIOMATIC_EXAMPLES})
add_executable(${name} ${name}.cpp)
endforeach()
set(ALL_EXAMPLE_TARGETS
${TARGETS_IDIOMATIC_EXAMPLES}
010-TestCase
020-MultiFile
)
foreach(name ${ALL_EXAMPLE_TARGETS})
target_link_libraries(${name} Catch3WithMain)
endforeach()
list(APPEND CATCH_TEST_TARGETS ${ALL_EXAMPLE_TARGETS})
set(CATCH_TEST_TARGETS ${CATCH_TEST_TARGETS} PARENT_SCOPE)
|