Codechange: Only apply FORTIFY_SOURCE in non-debug builds

It requires -O1 (or greater) and GCC spews out warnings if you try using it with -O0
This commit is contained in:
Charles Pigott 2020-06-27 12:17:05 +01:00
parent e5f931ef42
commit 887b912af1

View File

@ -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