summaryrefslogtreecommitdiffstats
path: root/Modules/CheckIncludeFileCXX.cmake
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2018-11-26 16:32:06 (GMT)
committerMarc Chevrier <marc.chevrier@gmail.com>2018-12-01 16:56:23 (GMT)
commitf266182aecb687f0c20c7fa7019ad0dde3222f46 (patch)
tree329ec6152a0290856004f3ac263c71acc740a4b3 /Modules/CheckIncludeFileCXX.cmake
parent29f9db5c63dbfa53acdb449fad78d716a4113a88 (diff)
downloadCMake-f266182aecb687f0c20c7fa7019ad0dde3222f46.zip
CMake-f266182aecb687f0c20c7fa7019ad0dde3222f46.tar.gz
CMake-f266182aecb687f0c20c7fa7019ad0dde3222f46.tar.bz2
Check* functions family: add support for LINK_OPTIONS
Fixes: #18521
Diffstat (limited to 'Modules/CheckIncludeFileCXX.cmake')
-rw-r--r--Modules/CheckIncludeFileCXX.cmake23
1 files changed, 17 insertions, 6 deletions
diff --git a/Modules/CheckIncludeFileCXX.cmake b/Modules/CheckIncludeFileCXX.cmake
index 42b5eaf..de5a83b 100644
--- a/Modules/CheckIncludeFileCXX.cmake
+++ b/Modules/CheckIncludeFileCXX.cmake
@@ -9,7 +9,7 @@ Provides a macro to check if a header file can be included in ``CXX``.
.. command:: CHECK_INCLUDE_FILE_CXX
- ::
+ .. code-block:: cmake
CHECK_INCLUDE_FILE_CXX(<include> <variable> [<flags>])
@@ -22,15 +22,19 @@ The following variables may be set before calling this macro to modify
the way the check is run:
``CMAKE_REQUIRED_FLAGS``
- string of compile command line flags
+ string of compile command line flags.
``CMAKE_REQUIRED_DEFINITIONS``
- list of macros to define (-DFOO=bar)
+ a :ref:`;-list <CMake Language Lists>` of macros to define (-DFOO=bar).
``CMAKE_REQUIRED_INCLUDES``
- list of include directories
+ a :ref:`;-list <CMake Language Lists>` of header search paths to pass to
+ the compiler.
+``CMAKE_REQUIRED_LINK_OPTIONS``
+ a :ref:`;-list <CMake Language Lists>` of options to add to the link command.
``CMAKE_REQUIRED_LIBRARIES``
- A list of libraries to link. See policy :policy:`CMP0075`.
+ a :ref:`;-list <CMake Language Lists>` of libraries to add to the link
+ command. See policy :policy:`CMP0075`.
``CMAKE_REQUIRED_QUIET``
- execute quietly without messages
+ execute quietly without messages.
See modules :module:`CheckIncludeFile` and :module:`CheckIncludeFiles`
to check for one or more ``C`` headers.
@@ -57,6 +61,11 @@ macro(CHECK_INCLUDE_FILE_CXX INCLUDE VARIABLE)
string(APPEND CMAKE_CXX_FLAGS " ${ARGV2}")
endif()
+ set(_CIF_LINK_OPTIONS)
+ if(CMAKE_REQUIRED_LINK_OPTIONS)
+ set(_CIF_LINK_OPTIONS LINK_OPTIONS ${CMAKE_REQUIRED_LINK_OPTIONS})
+ endif()
+
set(_CIF_LINK_LIBRARIES "")
if(CMAKE_REQUIRED_LIBRARIES)
cmake_policy(GET CMP0075 _CIF_CMP0075
@@ -84,11 +93,13 @@ macro(CHECK_INCLUDE_FILE_CXX INCLUDE VARIABLE)
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.cxx
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ ${_CIF_LINK_OPTIONS}
${_CIF_LINK_LIBRARIES}
CMAKE_FLAGS
-DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_INCLUDE_FILE_FLAGS}
"${CHECK_INCLUDE_FILE_CXX_INCLUDE_DIRS}"
OUTPUT_VARIABLE OUTPUT)
+ unset(_CIF_LINK_OPTIONS)
unset(_CIF_LINK_LIBRARIES)
if(${ARGC} EQUAL 3)