From f74c25802de11e4e4578b1c9473f99d106491da8 Mon Sep 17 00:00:00 2001 From: Don Hinton Date: Sun, 24 Dec 2017 11:30:24 -0800 Subject: 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 --- Modules/CheckIncludeFile.cmake | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Modules/CheckIncludeFile.cmake') 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}" -- cgit v1.2.1