-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathCMakeLists.txt
142 lines (99 loc) · 2 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
cmake_minimum_required(VERSION 3.2.0)
project(Optional C CXX)
set(target_name "optional")
# Target Names
set(backend "${target_name}")
set(app "${target_name}_app")
set(tests "${target_name}_unit_tests")
#################
#### Source Files
set(
backend_sources
# Headers
src/backend/account.h
src/backend/oauth.h
src/backend/rest.h
src/backend/option_chain.h
# Source
src/backend/account.cpp
src/backend/oauth.cpp
src/backend/rest.cpp
src/backend/option_chain.cpp
)
set(
app_sources
# Headers
src/app/display.h
# Sources
src/app/display.cpp
src/app/main.cpp
)
set(
tests_sources
tests/account_tests.cpp
tests/oauth_tests.cpp
tests/rest_tests.cpp
)
#######################
#### Required Libraries
# rapidjson located locally.
include_directories("${CMAKE_SOURCE_DIR}/external_libraries")
find_package(Curses REQUIRED)
if (Curses_FOUND)
include_directories(${CURSES_INCLUDE_DIR})
endif()
find_package(CURL REQUIRED)
if (CURL_FOUND)
include_directories(${CURL_INCLUDE_DIR})
endif()
set(
common_libs
${CMAKE_THREAD_LIBS_INIT}
${CURSES_LIBRARIES}
${CURL_LIBRARIES}
)
######################
#### Google Test Setup
#
# Downloads GTest from Google at configure time, and builds it at
# project compile time in the build directory.
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/tests")
include(GoogleTest)
#################
#### Build Config
set(CMAKE_CXX_STANDARD 17)
add_library(
${backend}
STATIC
${backend_sources}
)
add_executable(
${app}
${app_sources}
)
target_include_directories(
${app} PUBLIC
${CMAKE_SOURCE_DIR}/src/backend
)
target_link_libraries(
${app}
${common_libs}
${backend}
${ui}
)
#################
#### Tests Config
add_executable(
${tests}
${tests_sources}
)
target_include_directories(
${tests} PUBLIC
${CMAKE_SOURCE_DIR}/src/backend
)
target_link_libraries(
${tests}
gtest_main
${common_libs}
${backend}
)