Skip to content

Commit f1342cd

Browse files
disable _FORTIFY_SOURCE for debug builds
Enabling this macro in debug builds causes a warning which is then treated as an error failing the build: /usr/include/features.h:414:4: warning: _FORTIFY_SOURCE requires compiling with optimization (-O) [-W#warnings] 414 | # warning _FORTIFY_SOURCE requires compiling with optimization (-O)
1 parent 759d718 commit f1342cd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

cmake/Hardening.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ macro(
1717
set(NEW_CXX_DEFINITIONS "${NEW_CXX_DEFINITIONS} -D_GLIBCXX_ASSERTIONS")
1818
message(STATUS "*** GLIBC++ Assertions (vector[], string[], ...) enabled")
1919

20-
set(NEW_COMPILE_OPTIONS "${NEW_COMPILE_OPTIONS} -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3")
20+
if(NOT CMAKE_BUILD_TYPE MATCHES "Debug")
21+
set(NEW_COMPILE_OPTIONS "${NEW_COMPILE_OPTIONS} -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3")
22+
endif()
2123
message(STATUS "*** g++/clang _FORTIFY_SOURCE=3 enabled")
2224

2325
# check_cxx_compiler_flag(-fpie PIE)

0 commit comments

Comments
 (0)