aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2013-02-07 17:02:51 +0100
committerAndreas Schneider <asn@cryptomilk.org>2013-02-07 17:02:51 +0100
commitafe4c92bbff2bd46f5c48e50ccf2af893dc3d51b (patch)
treeed8c90328da3245d3957dfc75901f0f1a774a552 /cmake
parent186116f34a6f81eb9dea1c73a95e11ac18218691 (diff)
downloadlibssh-afe4c92bbff2bd46f5c48e50ccf2af893dc3d51b.tar.gz
libssh-afe4c92bbff2bd46f5c48e50ccf2af893dc3d51b.tar.xz
libssh-afe4c92bbff2bd46f5c48e50ccf2af893dc3d51b.zip
cmake: Fix setting -D_FORTIFY_SOURCE=2.
Diffstat (limited to 'cmake')
-rw-r--r--cmake/Modules/DefineCompilerFlags.cmake14
1 files changed, 8 insertions, 6 deletions
diff --git a/cmake/Modules/DefineCompilerFlags.cmake b/cmake/Modules/DefineCompilerFlags.cmake
index 0283b12f..582ea1ca 100644
--- a/cmake/Modules/DefineCompilerFlags.cmake
+++ b/cmake/Modules/DefineCompilerFlags.cmake
@@ -26,12 +26,14 @@ if (UNIX AND NOT WIN32)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector")
endif (WITH_STACK_PROTECTOR)
- string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWER)
- if (NOT CMAKE_BUILD_TYPE_LOWER MATCHES debug)
- check_c_compiler_flag("-D_FORTIFY_SOURCE=2" WITH_FORTIFY_SOURCE)
- if (WITH_FORTIFY_SOURCE)
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_FORTIFY_SOURCE=2")
- endif (WITH_FORTIFY_SOURCE)
+ if (CMAKE_BUILD_TYPE)
+ string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWER)
+ if (NOT CMAKE_BUILD_TYPE_LOWER MATCHES debug)
+ check_c_compiler_flag("-D_FORTIFY_SOURCE=2" WITH_FORTIFY_SOURCE)
+ if (WITH_FORTIFY_SOURCE)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_FORTIFY_SOURCE=2")
+ endif (WITH_FORTIFY_SOURCE)
+ endif()
endif()
endif (${CMAKE_C_COMPILER_ID} MATCHES "(GNU|Clang)")