mirror of
https://github.com/Kitware/CMake.git
synced 2026-07-11 00:57:38 +00:00
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
This commit is contained in:
11
Help/release/dev/CheckIncludeFile-required-libs.rst
Normal file
11
Help/release/dev/CheckIncludeFile-required-libs.rst
Normal file
@@ -0,0 +1,11 @@
|
||||
CheckIncludeFile-required-libs
|
||||
------------------------------
|
||||
|
||||
* The :module:`CheckIncludeFile` module ``check_include_file`` macro
|
||||
learned to honor the ``CMAKE_REQUIRED_LIBRARIES`` variable.
|
||||
|
||||
* The :module:`CheckIncludeFileCXX` module ``check_include_file_cxx`` macro
|
||||
learned to honor the ``CMAKE_REQUIRED_LIBRARIES`` variable.
|
||||
|
||||
* The :module:`CheckIncludeFiles` module ``check_include_files`` macro
|
||||
learned to honor the ``CMAKE_REQUIRED_LIBRARIES`` variable.
|
||||
@@ -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}"
|
||||
|
||||
@@ -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
|
||||
#
|
||||
@@ -58,6 +60,7 @@ macro(CHECK_INCLUDE_FILE_CXX INCLUDE VARIABLE)
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.cxx
|
||||
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
|
||||
LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}
|
||||
CMAKE_FLAGS
|
||||
-DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_INCLUDE_FILE_FLAGS}
|
||||
"${CHECK_INCLUDE_FILE_CXX_INCLUDE_DIRS}"
|
||||
|
||||
@@ -33,6 +33,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
|
||||
#
|
||||
@@ -102,6 +104,7 @@ macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE)
|
||||
${CMAKE_BINARY_DIR}
|
||||
${src}
|
||||
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
|
||||
LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}
|
||||
CMAKE_FLAGS
|
||||
-DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_INCLUDE_FILES_FLAGS}
|
||||
"${CHECK_INCLUDE_FILES_INCLUDE_DIRS}"
|
||||
|
||||
Reference in New Issue
Block a user