This got broken in
6f3e3cf6. The -Werror part wasn't
having the desired effect, so we were enabling FORTIFY_SOURCE
even when in -O0
Signed-off-by: John Spray <john.spray@redhat.com>
endif()
include(CheckCCompilerFlag)
-CHECK_C_COMPILER_FLAG("-Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=2 -Werror" HAS_FORTIFY_SOURCE)
+CHECK_C_COMPILER_FLAG("-Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=2" HAS_FORTIFY_SOURCE)
+if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
if(HAS_FORTIFY_SOURCE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=2")
endif()
+endif()
CHECK_C_COMPILER_FLAG(-fstack-protector-strong HAS_STACK_PROTECT)
if (HAS_STACK_PROTECT)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector-strong")