diff options
Diffstat (limited to 'Modules/CheckIncludeFiles.cmake')
-rw-r--r-- | Modules/CheckIncludeFiles.cmake | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Modules/CheckIncludeFiles.cmake b/Modules/CheckIncludeFiles.cmake index cd526e6..45e5c89 100644 --- a/Modules/CheckIncludeFiles.cmake +++ b/Modules/CheckIncludeFiles.cmake @@ -7,10 +7,16 @@ # # If CMAKE_REQUIRED_FLAGS is set then those flags will be passed into the # compile of the program - +# If CMAKE_REQUIRED_INCLUDES is set then those directories will be passed +# as include paths to the compiler MACRO(CHECK_INCLUDE_FILES INCLUDE VARIABLE) IF("${VARIABLE}" MATCHES "^${VARIABLE}$") + IF(CMAKE_REQUIRED_INCLUDES) + SET(CHECK_INCLUDE_FILES_INCLUDE_DIRS "-DINCLUDE_DIRECTORIES=${CMAKE_REQUIRED_INCLUDES}") + ELSE(CMAKE_REQUIRED_INCLUDES) + SET(CHECK_INCLUDE_FILES_INCLUDE_DIRS) + ENDIF(CMAKE_REQUIRED_INCLUDES) SET(CHECK_INCLUDE_FILES_CONTENT "/* */\n") SET(MACRO_CHECK_INCLUDE_FILES_FLAGS ${CMAKE_REQUIRED_FLAGS}) FOREACH(FILE ${INCLUDE}) @@ -28,6 +34,7 @@ MACRO(CHECK_INCLUDE_FILES INCLUDE VARIABLE) ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeTmp/CheckIncludeFiles.c CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_INCLUDE_FILES_FLAGS} + "${CHECK_INCLUDE_FILES_INCLUDE_DIRS}" OUTPUT_VARIABLE OUTPUT) IF(${VARIABLE}) MESSAGE(STATUS "Looking for include files ${VARIABLE} - found") |