-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCMakeLists.txt
91 lines (66 loc) · 3.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
85
86
87
88
89
90
91
cmake_minimum_required( VERSION 3.2 )
# ------------------------------------------------------------------------------
# PROJECT SETUP
# ------------------------------------------------------------------------------
project( matchine )
if( CMAKE_PROJECT_NAME STREQUAL "matchine" )
option( MATCHINE_TESTS "Build matchine tests" ON )
option( MATCHINE_DEMOS "Build matchine demos" ON )
else()
option( MATCHINE_TESTS "Build matchine tests" OFF )
option( MATCHINE_DEMOS "Build matchine demos" OFF )
endif()
# ------------------------------------------------------------------------------
# DEPENDENCIES
# ------------------------------------------------------------------------------
find_package( Boost )
find_package( Gtest QUIET )
find_package( Nonius QUIET )
# ------------------------------------------------------------------------------
# LIBRARY
# ------------------------------------------------------------------------------
add_library( matchine INTERFACE )
target_compile_features( matchine INTERFACE cxx_std_14 )
target_include_directories( matchine INTERFACE include )
# ------------------------------------------------------------------------------
# DEMOS
# ------------------------------------------------------------------------------
if( MATCHINE_TESTS )
add_executable( demo_match_polyobj demos/match_polyobj.cpp )
target_link_libraries( demo_match_polyobj PRIVATE matchine )
add_executable( demo_match_any demos/match_any.cpp )
set_target_properties( demo_match_any PROPERTIES CXX_STANDARD 17 )
target_link_libraries( demo_match_any PRIVATE matchine )
add_executable( demo_customize_match_for_variant demos/customize_match_for_variant.cpp )
set_target_properties( demo_customize_match_for_variant PROPERTIES CXX_STANDARD 17 )
target_link_libraries( demo_customize_match_for_variant PRIVATE matchine )
add_executable( demo_overload demos/overload.cpp )
set_target_properties( demo_overload PROPERTIES CXX_STANDARD 17 )
target_link_libraries( demo_overload PRIVATE matchine )
endif()
# ------------------------------------------------------------------------------
# TESTS
# ------------------------------------------------------------------------------
if( MATCHINE_TESTS )
set(files_test
tests/main.cpp
tests/match.test.cpp
tests/match_any.test.cpp
tests/meta.test.cpp
tests/overload.test.cpp
tests/signature.test.cpp
tests/type_hierarchy.test.cpp
)
add_executable( matchine_tests ${files_test} )
set_target_properties( matchine_tests PROPERTIES CXX_STANDARD 17 )
target_link_libraries( matchine_tests PRIVATE matchine gtest )
endif()
# ------------------------------------------------------------------------------
# BENCHMARKS
# ------------------------------------------------------------------------------
if (Nonius)
add_executable( benchmarks "benchmarks/dynamic_cast.cpp" )
target_link_libraries( benchmarks LINK_PUBLIC matchine nonius )
else()
message("<> Nonius not found, won't build benchmarks.")
endif()