mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-05 05:39:57 -05:00
@@ -9,7 +9,7 @@ Provides a macro to check if a header file can be included in ``C``.
|
||||
|
||||
.. command:: CHECK_INCLUDE_FILE
|
||||
|
||||
::
|
||||
.. code-block:: cmake
|
||||
|
||||
CHECK_INCLUDE_FILE(<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 the :module:`CheckIncludeFiles` module to check for multiple headers
|
||||
at once. See the :module:`CheckIncludeFileCXX` module to check for headers
|
||||
@@ -58,6 +62,11 @@ macro(CHECK_INCLUDE_FILE INCLUDE VARIABLE)
|
||||
string(APPEND CMAKE_C_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
|
||||
@@ -85,11 +94,13 @@ macro(CHECK_INCLUDE_FILE INCLUDE VARIABLE)
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.c
|
||||
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
|
||||
${_CIF_LINK_OPTIONS}
|
||||
${_CIF_LINK_LIBRARIES}
|
||||
CMAKE_FLAGS
|
||||
-DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_INCLUDE_FILE_FLAGS}
|
||||
"${CHECK_INCLUDE_FILE_C_INCLUDE_DIRS}"
|
||||
OUTPUT_VARIABLE OUTPUT)
|
||||
unset(_CIF_LINK_OPTIONS)
|
||||
unset(_CIF_LINK_LIBRARIES)
|
||||
|
||||
if(${ARGC} EQUAL 3)
|
||||
|
||||
Reference in New Issue
Block a user