summaryrefslogtreecommitdiff
path: root/Modules/CheckIncludeFile.cmake
diff options
context:
space:
mode:
authorDon Hinton <hintonda@gmail.com>2017-12-24 11:30:24 -0800
committerBrad King <brad.king@kitware.com>2018-01-10 14:13:32 -0500
commitf74c25802de11e4e4578b1c9473f99d106491da8 (patch)
tree6f3c7a0a38a33dd9fadc062fa3a7c877c9ee8c65 /Modules/CheckIncludeFile.cmake
parent40dea7e4b2e1c4518337bba284a233bf6f788a1a (diff)
downloadcmake-f74c25802de11e4e4578b1c9473f99d106491da8.tar.gz
CheckIncludeFiles: Honor CMAKE_REQUIRED_LIBRARIES
This is needed when cross compiling and the compiler requires a specific linker different from the default, e.g., when cross compiling from Darwin to Linux and passing `-fuse-ld=lld` to clang. Fixes: #9514
Diffstat (limited to 'Modules/CheckIncludeFile.cmake')
-rw-r--r--Modules/CheckIncludeFile.cmake3
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/CheckIncludeFile.cmake b/Modules/CheckIncludeFile.cmake
index e5554c448a..501fc9a1ee 100644
--- a/Modules/CheckIncludeFile.cmake
+++ b/Modules/CheckIncludeFile.cmake
@@ -27,6 +27,8 @@
# list of macros to define (-DFOO=bar)
# ``CMAKE_REQUIRED_INCLUDES``
# list of include directories
+# ``CMAKE_REQUIRED_LIBRARIES``
+# list of libraries to link
# ``CMAKE_REQUIRED_QUIET``
# execute quietly without messages
#
@@ -59,6 +61,7 @@ macro(CHECK_INCLUDE_FILE INCLUDE VARIABLE)
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.c
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}
CMAKE_FLAGS
-DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_INCLUDE_FILE_FLAGS}
"${CHECK_INCLUDE_FILE_C_INCLUDE_DIRS}"