File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 9898 -D ENABLE_LSAN:BOOL=${{ matrix.build.type == 'Debug' }}
9999 -D ENABLE_CPPCHECK:BOOL=TRUE
100100 -D ENABLE_CLANG_TIDY:BOOL=${{ contains(matrix.config.cc, 'clang') }}
101- -D ENABLE_HARDENINGS:BOOL=TRUE
102- -D ENABLE_FORTIFY_SOURCE:BOOL=${{ matrix.build.type != 'Debug' }}
101+ -D ENABLE_HARDENINGS:BOOL=${{ matrix.build.type != 'Debug' }}
103102
104103 - name : Build
105104 run : cmake --build --preset ${{ matrix.build.preset }}
@@ -198,8 +197,7 @@ jobs:
198197 -D ENABLE_ASAN:BOOL=${{ matrix.build.type == 'Debug' }}
199198 -D ENABLE_UBSAN:BOOL=${{ matrix.build.type == 'Debug' }}
200199 -D ENABLE_LSAN:BOOL=${{ matrix.build.type == 'Debug' }}
201- -D ENABLE_HARDENINGS:BOOL=TRUE
202- -D ENABLE_FORTIFY_SOURCE:BOOL=${{ matrix.build.type != 'Debug' }}
200+ -D ENABLE_HARDENINGS:BOOL=${{ matrix.build.type != 'Debug' }}
203201
204202 - name : Build
205203 run : cmake --build --preset ${{ matrix.build.preset }}
@@ -303,7 +301,7 @@ jobs:
303301 poetry run cmake --preset ${{ matrix.build.preset }}
304302 -D ENABLE_COVERAGE:BOOL=${{ matrix.build.type == 'Debug' }}
305303 -D ENABLE_ASAN:BOOL=${{ matrix.build.type == 'Debug' && matrix.config.cc == 'cl' }}
306- -D ENABLE_HARDENINGS:BOOL=TRUE
304+ -D ENABLE_HARDENINGS:BOOL=${{ matrix.build.type != 'Debug' }}
307305
308306 - name : Build
309307 run : cmake --build --preset ${{ matrix.build.preset }}
Original file line number Diff line number Diff line change @@ -64,7 +64,6 @@ cmake --preset <preset> \
6464 -D ENABLE_DOXYGEN=< bool> \
6565 -D ENABLE_COVERAGE=< bool> \
6666 -D ENABLE_HARDENINGS=< bool> \
67- -D ENABLE_FORTIFY_SOURCE=< bool> \
6867 -D ENABLE_ASAN=< bool> \
6968 -D ENABLE_LSAN=< bool> \
7069 -D ENABLE_UBSAN=< bool> \
Original file line number Diff line number Diff line change @@ -12,8 +12,6 @@ if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang|GNU")
1212 option (ENABLE_LSAN "Enable leak sanitizer" OFF )
1313 option (ENABLE_UBSAN "Enable undefined behavior sanitizer" OFF )
1414 option (ENABLE_TSAN "Enable thread sanitizer" OFF )
15- option (ENABLE_FORTIFY_SOURCE
16- "Enable -D_FORTIFY_SOURCE=3 (requires optimized build)" OFF )
1715endif ()
1816option (ENABLE_HARDENINGS "Enable hardenings" OFF )
1917
@@ -290,12 +288,13 @@ function(enable_hardenings target_name)
290288 /DYNAMICBASE
291289 /LARGEADDRESSAWARE
292290 /HIGHENTROPYVA )
293- elseif (CMAKE_CXX_COMPILER_ID MATCHES ".*Clang|GNU" )
291+ elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
292+ target_compile_options (${target_name} INTERFACE -fhardened )
293+ elseif (CMAKE_CXX_COMPILER_ID MATCHES ".*Clang" )
294294 target_compile_definitions (${target_name} INTERFACE _GLIBCXX_ASSERTIONS )
295- if (ENABLE_FORTIFY_SOURCE)
296- target_compile_options (${target_name} INTERFACE -U_FORTIFY_SOURCE
297- -D_FORTIFY_SOURCE=3 )
298- endif ()
295+ target_compile_options (${target_name} INTERFACE -U_FORTIFY_SOURCE
296+ -D_FORTIFY_SOURCE=3 )
297+
299298 if (LINUX )
300299 target_link_options (${target_name} INTERFACE -Wl,-z,noexecstack )
301300 endif ()
You can’t perform that action at this time.
0 commit comments