diff options
author | Brad King <brad.king@kitware.com> | 2006-02-09 18:14:57 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2006-02-09 18:14:57 (GMT) |
commit | c90b8d0537ff398f0ceb85c681d64f46893f1faf (patch) | |
tree | 7ea3c9bc22b04d41c1a441200ca861b8d608b364 /Modules | |
parent | ef88c8cbc83e8d66a3e3f6c72eb50724b9cec010 (diff) | |
download | CMake-c90b8d0537ff398f0ceb85c681d64f46893f1faf.zip CMake-c90b8d0537ff398f0ceb85c681d64f46893f1faf.tar.gz CMake-c90b8d0537ff398f0ceb85c681d64f46893f1faf.tar.bz2 |
ENH: Patch from Alexander Neundorf to improve behavior.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CheckCSourceCompiles.cmake | 4 | ||||
-rw-r--r-- | Modules/CheckCXXSourceCompiles.cmake | 4 | ||||
-rw-r--r-- | Modules/CheckIncludeFiles.cmake | 9 |
3 files changed, 16 insertions, 1 deletions
diff --git a/Modules/CheckCSourceCompiles.cmake b/Modules/CheckCSourceCompiles.cmake index a6fc692..35b3d7e 100644 --- a/Modules/CheckCSourceCompiles.cmake +++ b/Modules/CheckCSourceCompiles.cmake @@ -15,10 +15,14 @@ MACRO(CHECK_C_SOURCE_COMPILES SOURCE VAR) IF(CMAKE_REQUIRED_LIBRARIES) SET(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") + ELSE(CMAKE_REQUIRED_LIBRARIES) + SET(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES) ENDIF(CMAKE_REQUIRED_LIBRARIES) IF(CMAKE_REQUIRED_INCLUDES) SET(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") + ELSE(CMAKE_REQUIRED_INCLUDES) + SET(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES) ENDIF(CMAKE_REQUIRED_INCLUDES) FILE(WRITE "${CMAKE_BINARY_DIR}/CMakeFiles/CMakeTmp/src.c" "${SOURCE}") diff --git a/Modules/CheckCXXSourceCompiles.cmake b/Modules/CheckCXXSourceCompiles.cmake index 871208e..8f6e12b 100644 --- a/Modules/CheckCXXSourceCompiles.cmake +++ b/Modules/CheckCXXSourceCompiles.cmake @@ -15,10 +15,14 @@ MACRO(CHECK_CXX_SOURCE_COMPILES SOURCE VAR) IF(CMAKE_REQUIRED_LIBRARIES) SET(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") + ELSE(CMAKE_REQUIRED_LIBRARIES) + SET(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES) ENDIF(CMAKE_REQUIRED_LIBRARIES) IF(CMAKE_REQUIRED_INCLUDES) SET(CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") + ELSE(CMAKE_REQUIRED_INCLUDES) + SET(CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES) ENDIF(CMAKE_REQUIRED_INCLUDES) FILE(WRITE "${CMAKE_BINARY_DIR}/CMakeFiles/CMakeTmp/src.cxx" "${SOURCE}") 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") |