summaryrefslogtreecommitdiffstats
path: root/Modules/CheckIncludeFile.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2006-02-10 00:23:18 (GMT)
committerBrad King <brad.king@kitware.com>2006-02-10 00:23:18 (GMT)
commitf0a1da00c1d46bd3ffd0e1f4cfd76a3bbf2a2155 (patch)
tree2cbfbb98abe5416da719d9960563efbd7419bc8f /Modules/CheckIncludeFile.cmake
parentf8a8e88a081600e8f6bbad8172f77fb4f422b5cd (diff)
downloadCMake-f0a1da00c1d46bd3ffd0e1f4cfd76a3bbf2a2155.zip
CMake-f0a1da00c1d46bd3ffd0e1f4cfd76a3bbf2a2155.tar.gz
CMake-f0a1da00c1d46bd3ffd0e1f4cfd76a3bbf2a2155.tar.bz2
ENH: Made Check* modules more consistent and well documented. Added CMAKE_REQUIRED_DEFINITIONS option.
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)