Skip to content

Commit

Permalink
Only enabled FORTIFY_SOURCE in non-Debug
Browse files Browse the repository at this point in the history
  • Loading branch information
lefticus authored Apr 29, 2023
1 parent 0cba4db commit 4e774d4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cmake/Hardening.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ macro(
set(NEW_CXX_DEFINITIONS "${NEW_CXX_DEFINITIONS} -D_GLIBCXX_ASSERTIONS")
message(STATUS "*** GLIBC++ Assertions (vector[], string[], ...) enabled")

set(NEW_COMPILE_OPTIONS "${NEW_COMPILE_OPTIONS} -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3")
message(STATUS "*** g++/clang _FORTIFY_SOURCE=3 enabled")

if (NOT ${CMAKE_BUILD_TYPE} STREQUAL "Debug")
set(NEW_COMPILE_OPTIONS "${NEW_COMPILE_OPTIONS} -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3")
message(STATUS "*** g++/clang _FORTIFY_SOURCE=3 enabled")
endif()

# check_cxx_compiler_flag(-fpie PIE)
#if(PIE)
# set(NEW_COMPILE_OPTIONS ${NEW_COMPILE_OPTIONS} -fpie)
Expand Down

0 comments on commit 4e774d4

Please sign in to comment.