diff options
| author | Rutger Broekhoff | 2026-08-28 18:03:05 +0200 |
|---|---|---|
| committer | Rutger Broekhoff | 2026-08-28 18:03:05 +0200 |
| commit | 973aec43ea54bbf95b64fbcb636403401d1ca60e (patch) | |
| tree | 41b7911c420766a9b463245b9296f44c5bf35258 /server/CMakeLists.txt | |
| download | routemon-973aec43ea54bbf95b64fbcb636403401d1ca60e.tar.gz routemon-973aec43ea54bbf95b64fbcb636403401d1ca60e.zip | |
Import from e4b104792206ee7ea64bf39c6b7d2c0c230f9d14
Diffstat (limited to 'server/CMakeLists.txt')
| -rw-r--r-- | server/CMakeLists.txt | 86 |
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 @@ | |||
| 1 | cmake_minimum_required(VERSION 4.3) | ||
| 2 | |||
| 3 | project(routemon LANGUAGES CXX) | ||
| 4 | |||
| 5 | # Hardening options from https://best.openssf.org/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C++.html | ||
| 6 | add_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 | ) | ||
| 20 | add_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 | |||
| 27 | add_library(routemon_lib) | ||
| 28 | target_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 | |||
| 57 | add_executable(routemon src/main.cpp) | ||
| 58 | target_link_libraries(routemon routemon_lib) | ||
| 59 | install(TARGETS routemon) | ||
| 60 | |||
| 61 | find_package(Boost 1.90 REQUIRED COMPONENTS json locale url) | ||
| 62 | target_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 | ||
| 65 | find_package(ICU REQUIRED COMPONENTS data i18n uc) | ||
| 66 | target_link_libraries(routemon_lib ICU::data ICU::i18n ICU::uc) | ||
| 67 | |||
| 68 | find_library(pugixml pugixml REQUIRED) | ||
| 69 | target_link_libraries(routemon_lib pugixml) | ||
| 70 | |||
| 71 | find_package(OpenSSL REQUIRED) | ||
| 72 | target_link_libraries(routemon_lib OpenSSL::SSL) | ||
| 73 | |||
| 74 | find_package(SQLite3 REQUIRED) | ||
| 75 | target_link_libraries(routemon_lib SQLite3::SQLite3) | ||
| 76 | |||
| 77 | find_package(Gettext REQUIRED) | ||
| 78 | gettext_create_translations( | ||
| 79 | routemon.pot | ||
| 80 | ALL | ||
| 81 | locale/nl.po | ||
| 82 | locale/en_US.po | ||
| 83 | ) | ||
| 84 | |||
| 85 | find_package(expat REQUIRED) | ||
| 86 | target_link_libraries(routemon_lib expat::expat) | ||