summaryrefslogtreecommitdiffstats
path: root/server/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'server/CMakeLists.txt')
-rw-r--r--server/CMakeLists.txt86
1 files changed, 86 insertions, 0 deletions
diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt
new file mode 100644
index 0000000..df4eb90
--- /dev/null
+++ b/server/CMakeLists.txt
@@ -0,0 +1,86 @@
1cmake_minimum_required(VERSION 4.3)
2
3project(routemon LANGUAGES CXX)
4
5# Hardening options from https://best.openssf.org/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C++.html
6add_compile_options(
7 # -O2
8 # -g
9 -fno-omit-frame-pointer
10 -Wall -Wextra -Wformat -Wformat=2 -Wconversion -Wimplicit-fallthrough
11 -Werror=format-security
12 -U_FORTIFY_SOURCE # -D_FORTIFY_SOURCE=3 (unfortunately breaks the std module)
13 -D_GLIBCXX_ASSERTIONS
14 -fstrict-flex-arrays=3
15 -fstack-clash-protection -fstack-protector-strong
16 -fPIE -fcf-protection=full
17 -fno-delete-null-pointer-checks -fno-strict-overflow -fno-strict-aliasing -ftrivial-auto-var-init=zero
18 -DBOOST_ASIO_NO_DEPRECATED
19)
20add_link_options(
21 -pie
22 -Wl,-z,nodlopen -Wl,-z,noexecstack
23 -Wl,-z,relro -Wl,-z,now
24 -Wl,--as-needed -Wl,--no-copy-dt-needed-entries
25)
26
27add_library(routemon_lib)
28target_sources(routemon_lib
29 PUBLIC FILE_SET CXX_MODULES FILES
30 src/api.cppm
31 src/api.cpp
32 src/database.cppm
33 src/config.cppm
34 src/config.cpp
35 src/datex2.cppm
36 src/geo.cppm
37 src/gpx.cppm
38 src/gpx.cpp
39 src/http_client.cppm
40 src/http_common.cppm
41 src/http_server.cppm
42 src/locale.cppm
43 src/log.cppm
44 src/problem.cppm
45 src/req_ctx.cppm
46 src/routemon.cppm
47 src/rwgps.cppm
48 src/sqlite3.cppm
49 src/srv.cppm
50 src/time.cppm
51 src/trace.cppm
52 src/util.cppm
53 src/xml.cppm
54 src/xml.cpp
55)
56
57add_executable(routemon src/main.cpp)
58target_link_libraries(routemon routemon_lib)
59install(TARGETS routemon)
60
61find_package(Boost 1.90 REQUIRED COMPONENTS json locale url)
62target_link_libraries(routemon_lib Boost::headers Boost::json Boost::locale Boost::url)
63
64# Already arranged via Boost::locale but this makes it more explicit, I guess
65find_package(ICU REQUIRED COMPONENTS data i18n uc)
66target_link_libraries(routemon_lib ICU::data ICU::i18n ICU::uc)
67
68find_library(pugixml pugixml REQUIRED)
69target_link_libraries(routemon_lib pugixml)
70
71find_package(OpenSSL REQUIRED)
72target_link_libraries(routemon_lib OpenSSL::SSL)
73
74find_package(SQLite3 REQUIRED)
75target_link_libraries(routemon_lib SQLite3::SQLite3)
76
77find_package(Gettext REQUIRED)
78gettext_create_translations(
79 routemon.pot
80 ALL
81 locale/nl.po
82 locale/en_US.po
83)
84
85find_package(expat REQUIRED)
86target_link_libraries(routemon_lib expat::expat)