-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
132 lines (105 loc) · 2.87 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
# this is the current default version Visual Studio is using :P
cmake_minimum_required(VERSION 3.6)
project(location_service)
set(CMAKE_CXX_STANDARD 14)
# Boost dependency
find_package(Boost REQUIRED)
# Find our cpprestsdk libs
# Finding any arbitrary header will do until more robust find modules are written
find_path(CPPREST_INCLUDE_DIR cpprest/http_listener.h)
find_library(CPPREST_LIBRARY cpprest_2_9)
# Catch dependency for testing
# Find the Catch header then create an INTERFACE
# library from it which we can then later include
find_path(CATCH_INCLUDE_DIR catch.hpp)
add_library(CATCH_LIBRARY INTERFACE)
target_include_directories(CATCH_LIBRARY INTERFACE ${CATCH_INCLUDE_DIR})
# set all the headers for the project
set(
HEADERS
./include/csv_grammar.hpp
./include/csv_row_t.hpp
./include/csv_parser.hpp
./include/csv_row_to_point.hpp
./include/point_t.hpp
./include/equal.hpp
./include/csv_to_rtree.hpp
./include/location_server.hpp
./include/csv_rows_to_zip_point_map.hpp
./include/csv_rows_from_range.hpp
./include/find_zip_data.hpp
./include/handle_http_req.hpp
)
# create common library of source files to
# link against
set(
SOURCES
./src/csv_parser.cpp
./src/csv_row_to_point.cpp
./src/point_t.cpp
./src/equal.cpp
./src/csv_to_rtree.cpp
./src/location_server.cpp
./src/csv_rows_to_zip_point_map.cpp
./src/find_zip_data.cpp
./src/handle_http_req.cpp
)
add_library(
locservice
STATIC ${SOURCES})
target_include_directories(
locservice
PUBLIC
./include
${Boost_INCLUDE_DIR}
${CPPREST_INCLUDE_DIR}
)
target_link_libraries(
locservice
${CPPREST_LIBRARY}
)
# these are all of our current testing files
set(
TESTS
./test/csv_grammar_tests.cpp
./test/csv_parser_tests.cpp
./test/csv_row_to_point_tests.cpp
./test/csv_to_rtree_tests.cpp
./test/location_server_tests.cpp
./test/csv_rows_to_zip_point_map_tests.cpp
)
# generate release binary
add_executable(
location_service
./release/main.cpp
${HEADERS}
)
target_link_libraries(
location_service
locservice
)
# generate testing binary
add_executable(
location_service_tests
./debug/main.cpp
${HEADERS}
${TESTS}
)
target_link_libraries(
location_service_tests
locservice
${CATCH_LIBRARY}
)
# create a simple install rule (probably needs to be ironed out)
install(
TARGETS location_service location_service_tests
DESTINATION bin
)
# add some CTest functionality as well
# unfortunately, only the Catch binary is run so as far as
# CTest knows, only one test is actually run
# see: https://github.com/philsquared/Catch/blob/master/contrib/ParseAndAddCatchTests.cmake
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake.modules/")
enable_testing()
include(ParseAndAddCatchTests)
ParseAndAddCatchTests(location_service_tests)