aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Walch <florian@fwalch.com>2016-02-09 22:22:30 +0100
committerFlorian Walch <florian@fwalch.com>2016-02-10 00:17:55 +0100
commite7615ddc22944504685d0ba3957626af9354148a (patch)
treef9c40cbd788b57bc07613c551751111b4bff9782
parentdcdb50b64b898b64e3cb4ce05d0a2c3152740e3b (diff)
downloadrneovim-e7615ddc22944504685d0ba3957626af9354148a.tar.gz
rneovim-e7615ddc22944504685d0ba3957626af9354148a.tar.bz2
rneovim-e7615ddc22944504685d0ba3957626af9354148a.zip
CMake: Add #include in _FORTIFY_SOURCE check. #4214
Some toolchains apparently set _FORTIFY_SOURCE=2 in internal header files. Include <string.h> (which in turn should include such internal header files) before checking the value of _FORTIFY_SOURCE to catch that. Fixes #4183.
-rw-r--r--CMakeLists.txt4
1 files changed, 4 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c6ed0f0cdf..527a085d3e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -153,7 +153,11 @@ if(${INIT_FLAGS_NAME})
set(CMAKE_REQUIRED_FLAGS "${${INIT_FLAGS_NAME}}")
endif()
+# Include <string.h> because some toolchains define _FORTIFY_SOURCE=2 in
+# internal header files, which should in turn be #included by <string.h>.
check_c_source_compiles("
+#include <string.h>
+
#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 1
#error \"_FORTIFY_SOURCE > 1\"
#endif