From 973aec43ea54bbf95b64fbcb636403401d1ca60e Mon Sep 17 00:00:00 2001 From: Rutger Broekhoff Date: Fri, 28 Aug 2026 18:03:05 +0200 Subject: Import from e4b104792206ee7ea64bf39c6b7d2c0c230f9d14 --- server/CMakeLists.txt | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 server/CMakeLists.txt (limited to 'server/CMakeLists.txt') 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 @@ +cmake_minimum_required(VERSION 4.3) + +project(routemon LANGUAGES CXX) + +# Hardening options from https://best.openssf.org/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C++.html +add_compile_options( + # -O2 + # -g + -fno-omit-frame-pointer + -Wall -Wextra -Wformat -Wformat=2 -Wconversion -Wimplicit-fallthrough + -Werror=format-security + -U_FORTIFY_SOURCE # -D_FORTIFY_SOURCE=3 (unfortunately breaks the std module) + -D_GLIBCXX_ASSERTIONS + -fstrict-flex-arrays=3 + -fstack-clash-protection -fstack-protector-strong + -fPIE -fcf-protection=full + -fno-delete-null-pointer-checks -fno-strict-overflow -fno-strict-aliasing -ftrivial-auto-var-init=zero + -DBOOST_ASIO_NO_DEPRECATED +) +add_link_options( + -pie + -Wl,-z,nodlopen -Wl,-z,noexecstack + -Wl,-z,relro -Wl,-z,now + -Wl,--as-needed -Wl,--no-copy-dt-needed-entries +) + +add_library(routemon_lib) +target_sources(routemon_lib + PUBLIC FILE_SET CXX_MODULES FILES + src/api.cppm + src/api.cpp + src/database.cppm + src/config.cppm + src/config.cpp + src/datex2.cppm + src/geo.cppm + src/gpx.cppm + src/gpx.cpp + src/http_client.cppm + src/http_common.cppm + src/http_server.cppm + src/locale.cppm + src/log.cppm + src/problem.cppm + src/req_ctx.cppm + src/routemon.cppm + src/rwgps.cppm + src/sqlite3.cppm + src/srv.cppm + src/time.cppm + src/trace.cppm + src/util.cppm + src/xml.cppm + src/xml.cpp +) + +add_executable(routemon src/main.cpp) +target_link_libraries(routemon routemon_lib) +install(TARGETS routemon) + +find_package(Boost 1.90 REQUIRED COMPONENTS json locale url) +target_link_libraries(routemon_lib Boost::headers Boost::json Boost::locale Boost::url) + +# Already arranged via Boost::locale but this makes it more explicit, I guess +find_package(ICU REQUIRED COMPONENTS data i18n uc) +target_link_libraries(routemon_lib ICU::data ICU::i18n ICU::uc) + +find_library(pugixml pugixml REQUIRED) +target_link_libraries(routemon_lib pugixml) + +find_package(OpenSSL REQUIRED) +target_link_libraries(routemon_lib OpenSSL::SSL) + +find_package(SQLite3 REQUIRED) +target_link_libraries(routemon_lib SQLite3::SQLite3) + +find_package(Gettext REQUIRED) +gettext_create_translations( + routemon.pot + ALL + locale/nl.po + locale/en_US.po +) + +find_package(expat REQUIRED) +target_link_libraries(routemon_lib expat::expat) -- cgit v1.3