summaryrefslogtreecommitdiffstats
path: root/Modules/CheckIncludeFile.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/CheckIncludeFile.cmake')
-rw-r--r--Modules/CheckIncludeFile.cmake14
1 files changed, 14 insertions, 0 deletions
diff --git a/Modules/CheckIncludeFile.cmake b/Modules/CheckIncludeFile.cmake
index a3de4cf..aafe7a8 100644
--- a/Modules/CheckIncludeFile.cmake
+++ b/Modules/CheckIncludeFile.cmake
@@ -7,8 +7,20 @@
# an optional third argument is the CFlags to add to the compile line
# or you can use CMAKE_REQUIRED_FLAGS
#
+# 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
+# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
+# CMAKE_REQUIRED_INCLUDES = list of include directories
+#
MACRO(CHECK_INCLUDE_FILE INCLUDE VARIABLE)
IF("${VARIABLE}" MATCHES "^${VARIABLE}$")
+ IF(CMAKE_REQUIRED_INCLUDES)
+ SET(CHECK_INCLUDE_FILE_C_INCLUDE_DIRS "-DINCLUDE_DIRECTORIES=${CMAKE_REQUIRED_INCLUDES}")
+ ELSE(CMAKE_REQUIRED_INCLUDES)
+ SET(CHECK_INCLUDE_FILE_C_INCLUDE_DIRS)
+ ENDIF(CMAKE_REQUIRED_INCLUDES)
SET(MACRO_CHECK_INCLUDE_FILE_FLAGS ${CMAKE_REQUIRED_FLAGS})
SET(CHECK_INCLUDE_FILE_VAR ${INCLUDE})
CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CheckIncludeFile.c.in
@@ -22,8 +34,10 @@ MACRO(CHECK_INCLUDE_FILE INCLUDE VARIABLE)
TRY_COMPILE(${VARIABLE}
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}/CMakeFiles/CMakeTmp/CheckIncludeFile.c
+ COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
CMAKE_FLAGS
-DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_INCLUDE_FILE_FLAGS}
+ "${CHECK_INCLUDE_FILE_C_INCLUDE_DIRS}"
OUTPUT_VARIABLE OUTPUT)
IF(${ARGC} EQUAL 3)