-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
148 lines (125 loc) · 3.21 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
cmake_minimum_required(VERSION 3.10)
project(vb6_parser)
set(CMAKE_CXX_STANDARD 20)
#------------------------------------------------------------------------------
# see https://google.github.io/googletest/quickstart-cmake.html
include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/7df7853ea02371f6d24ccf4a0cf9e16553d23d05.zip
)
# for Windows: prevent overriding the parent project's compiler/linker settings
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
#------------------------------------------------------------------------------
add_compile_options($<$<CXX_COMPILER_ID:GNU,Clang>:-Wall> $<$<CXX_COMPILER_ID:GNU,Clang>:-Wextra>)
#find_package(GTest CONFIG REQUIRED) # GoogleTest with vcpkg
find_package(ut CONFIG REQUIRED)
find_package(Threads REQUIRED)
find_package(Boost REQUIRED QUIET COMPONENTS system)
add_library(vb6_parser_lib
src/raw_ast_printer.cpp
src/raw_ast_printer.hpp
src/color_console.cpp
src/color_console.hpp
src/cpp_ast_printer.cpp
src/cpp_ast_printer.hpp
src/vb6_ast.hpp
src/vb6_ast_adapt.hpp
src/vb6_config.hpp
src/vb6_error_handler.hpp
src/vb6_parser.cpp
src/vb6_parser.hpp
src/vb6_parser_def.hpp
src/vb6_parser_functions.cpp
src/vb6_parser_helper.cpp
src/vb6_parser_keywords.hpp
src/vb6_parser_operators.hpp
src/vb6_parser_statements.cpp
src/vb6_parser_statements_def.hpp
src/vb6_ast_printer.cpp
src/vb6_ast_printer.hpp
src/visual_basic_x3.hpp
)
target_compile_definitions(vb6_parser_lib
PRIVATE
-DBOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
-DBOOST_MPL_LIMIT_LIST_SIZE=30
)
target_link_libraries(vb6_parser_lib
PRIVATE
Boost::system
)
add_executable(vb6_parser
src/vb6_parser_main.cpp
src/vb6_test1.cpp
src/vb6_test2.cpp
)
target_compile_definitions(vb6_parser
PRIVATE
-DBOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
-DBOOST_MPL_LIMIT_LIST_SIZE=30
)
target_link_libraries(vb6_parser
PRIVATE
vb6_parser_lib
Boost::system
Threads::Threads
)
# ---- test
add_executable(vb6_parser.ut
#src/test_gosub.cpp
#src/test_grammar_helper_gtest.hpp
#src/vb6_parser_statements_test.cpp
src/vb6_parser.ut.cpp
)
target_compile_definitions(vb6_parser.ut
PRIVATE
-DBOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
-DBOOST_MPL_LIMIT_LIST_SIZE=30
)
target_link_libraries(vb6_parser.ut
PRIVATE
vb6_parser_lib
Boost::ut
Boost::system
Threads::Threads
)
add_executable(vb6_parser_test
src/test_gosub.cpp
src/test_grammar_helper_gtest.hpp
src/vb6_parser_statements_test.cpp
src/vb6_parser_test.cpp
src/vb6_parser_test_main.cpp
)
target_compile_definitions(vb6_parser_test
PRIVATE
-DBOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
-DBOOST_MPL_LIMIT_LIST_SIZE=30
)
target_link_libraries(vb6_parser_test
PRIVATE
vb6_parser_lib
gtest_main
Boost::system
Threads::Threads
)
#[[
# GoogleTest with vcpkg, probably not a good idea
target_link_libraries(vb6_parser_test
PRIVATE
vb6_parser_lib
GTest::gtest
GTest::gtest_main
GTest::gmock
GTest::gmock_main
Boost::system
Threads::Threads
)
#]]
set_target_properties(vb6_parser.ut PROPERTIES EXCLUDE_FROM_ALL 1)
include(CTest)
#enable_testing()
include(GoogleTest)
gtest_discover_tests(vb6_parser_test)
add_test(AllTestsInMain vb6_parser_test)