@@ -17,28 +17,30 @@ add_compile_definitions(DEV_STAGE=${DEV_STAGE})
1717
1818message (STATUS "DEV_STAGE is set to ${DEV_STAGE} " )
1919
20+ option (UPQ_HARDENING "Enable compile-time hardening flags" ON )
21+
2022find_package (OpenSSL REQUIRED )
2123find_package (PostgreSQL REQUIRED )
2224
2325include (FetchContent )
2426
2527FetchContent_Declare (
2628 uvent
27- GIT_REPOSITORY https://github.com/Usub-development /uvent.git
29+ GIT_REPOSITORY https://github.com/Usub-Foundation /uvent.git
2830 GIT_TAG main
2931 OVERRIDE_FIND_PACKAGE
3032)
3133
3234FetchContent_Declare (
3335 ureflect
34- GIT_REPOSITORY https://github.com/Usub-development /ureflect.git
36+ GIT_REPOSITORY https://github.com/Usub-Foundation /ureflect.git
3537 GIT_TAG main
3638 OVERRIDE_FIND_PACKAGE
3739)
3840
3941FetchContent_Declare (
4042 ujson
41- GIT_REPOSITORY https://github.com/Usub-development /ujson.git
43+ GIT_REPOSITORY https://github.com/Usub-Foundation /ujson.git
4244 GIT_TAG main
4345 OVERRIDE_FIND_PACKAGE
4446)
@@ -75,6 +77,24 @@ if (TARGET PostgreSQL::pq)
7577 target_link_libraries (upq PUBLIC PostgreSQL::pq )
7678endif ()
7779
80+ if (UPQ_HARDENING)
81+ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang" )
82+ target_compile_options (upq PRIVATE
83+ -Wall -Wextra -Wpedantic
84+ -Wformat=2 -Wformat-security
85+ -Wcast-qual -Wcast-align
86+ -Wnull-dereference
87+ -fstack-protector-strong
88+ $<$<NOT :$<CONFIG :Debug >>:-D_FORTIFY_SOURCE =2>
89+ )
90+ target_link_options (upq PRIVATE
91+ -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack
92+ )
93+ elseif (MSVC )
94+ target_compile_options (upq PRIVATE /W4 /guard:cf /sdl )
95+ endif ()
96+ endif ()
97+
7898set_target_properties (upq PROPERTIES
7999 EXPORT_NAME upq
80100 VERSION ${PROJECT_VERSION}
@@ -101,14 +121,14 @@ if (UPQ_BUILD_EXAMPLES)
101121
102122 FetchContent_Declare (
103123 ulog
104- GIT_REPOSITORY https://github.com/Usub-development /ulog.git
124+ GIT_REPOSITORY https://github.com/Usub-Foundation /ulog.git
105125 GIT_TAG main
106126 OVERRIDE_FIND_PACKAGE
107127 )
108128 FetchContent_Declare (
109129 unet
110- GIT_REPOSITORY https://github.com/Usub-development /unet.git
111- GIT_TAG main
130+ GIT_REPOSITORY https://github.com/Usub-Foundation /unet.git
131+ GIT_TAG v0.2.1
112132 OVERRIDE_FIND_PACKAGE
113133 )
114134 FetchContent_MakeAvailable (unet ulog)
0 commit comments