aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2018-08-20 17:09:28 +0200
committerAndreas Schneider <asn@cryptomilk.org>2018-08-20 18:42:03 +0200
commit99a9cf0fcb1a04aa194fcee5f029163ea69e7506 (patch)
tree19b8f0e34db2494003ef331fc3a1e13d533a5753 /cmake
parentfd157befae1452208930abb2a30d97d95a1c4cd6 (diff)
downloadlibssh-99a9cf0fcb1a04aa194fcee5f029163ea69e7506.tar.gz
libssh-99a9cf0fcb1a04aa194fcee5f029163ea69e7506.tar.xz
libssh-99a9cf0fcb1a04aa194fcee5f029163ea69e7506.zip
cmake: Respect CMAKE_REQUIRED_* variables in CHECK_C_COMPILER_FLAG_SSP
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/Modules/CheckCCompilerFlagSSP.cmake7
1 files changed, 5 insertions, 2 deletions
diff --git a/cmake/Modules/CheckCCompilerFlagSSP.cmake b/cmake/Modules/CheckCCompilerFlagSSP.cmake
index 2fe43954..870f68a1 100644
--- a/cmake/Modules/CheckCCompilerFlagSSP.cmake
+++ b/cmake/Modules/CheckCCompilerFlagSSP.cmake
@@ -16,11 +16,14 @@
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+include_guard(GLOBAL)
include(CheckCSourceCompiles)
-function(CHECK_C_COMPILER_FLAG_SSP _FLAG _RESULT)
+macro(CHECK_C_COMPILER_FLAG_SSP _FLAG _RESULT)
set(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}")
set(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}")
+
check_c_source_compiles("int main(int argc, char **argv) { char buffer[256]; return buffer[argc]=0;}" ${_RESULT})
+
set(CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
-endfunction(CHECK_C_COMPILER_FLAG_SSP)
+endmacro(CHECK_C_COMPILER_FLAG_SSP)