Skip to content

Commit

Permalink
Codechange: Only apply FORTIFY_SOURCE in non-debug builds
Browse files Browse the repository at this point in the history
It requires -O1 (or greater) and GCC spews out warnings if you try using it with -O0
  • Loading branch information
LordAro committed Jun 27, 2020
1 parent e5f931e commit 887b912
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmake/CompileFlags.cmake
Expand Up @@ -31,7 +31,7 @@ macro(compile_flags)
# it does not appear to support the $<> tags.
add_compile_options(
"$<$<CONFIG:Debug>:-D_DEBUG>"
"$<$<CONFIG:Debug>:-D_FORTIFY_SOURCE=2>"
"$<$<NOT:$<CONFIG:Debug>>:-D_FORTIFY_SOURCE=2>" # FORTIFY_SOURCE should only be used in non-debug builds (requires -O1+)
)

# Prepare a generator that checks if we are not a debug, and don't have asserts
Expand Down

0 comments on commit 887b912

Please sign in to comment.