]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: fix FORTIFY_SOURCE check 9987/head
authorJohn Spray <john.spray@redhat.com>
Tue, 28 Jun 2016 14:54:13 +0000 (15:54 +0100)
committerJohn Spray <john.spray@redhat.com>
Tue, 28 Jun 2016 14:54:13 +0000 (15:54 +0100)
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>
src/CMakeLists.txt

index 16a22d66160cf0f61409f97475f5e5f84d9c86d9..0bda6635f73862f0520e9e37009fdcba1c25feb0 100644 (file)
@@ -26,10 +26,12 @@ if(NOT CMAKE_BUILD_TYPE)
 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")