1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-12-24 19:37:48 +03:00

cmake: Respect CMAKE_REQUIRED_* variables in CHECK_C_COMPILER_FLAG_SSP

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Andreas Schneider
2018-08-20 17:09:28 +02:00
parent fd157befae
commit 99a9cf0fcb

View File

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