ENH: Patch from Alexander Neundorf to improve behavior.
This commit is contained in:
parent
ef88c8cbc8
commit
c90b8d0537
@ -15,10 +15,14 @@ MACRO(CHECK_C_SOURCE_COMPILES SOURCE VAR)
|
|||||||
IF(CMAKE_REQUIRED_LIBRARIES)
|
IF(CMAKE_REQUIRED_LIBRARIES)
|
||||||
SET(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES
|
SET(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES
|
||||||
"-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
|
"-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
|
||||||
|
ELSE(CMAKE_REQUIRED_LIBRARIES)
|
||||||
|
SET(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES)
|
||||||
ENDIF(CMAKE_REQUIRED_LIBRARIES)
|
ENDIF(CMAKE_REQUIRED_LIBRARIES)
|
||||||
IF(CMAKE_REQUIRED_INCLUDES)
|
IF(CMAKE_REQUIRED_INCLUDES)
|
||||||
SET(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES
|
SET(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES
|
||||||
"-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}")
|
"-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}")
|
||||||
|
ELSE(CMAKE_REQUIRED_INCLUDES)
|
||||||
|
SET(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES)
|
||||||
ENDIF(CMAKE_REQUIRED_INCLUDES)
|
ENDIF(CMAKE_REQUIRED_INCLUDES)
|
||||||
FILE(WRITE "${CMAKE_BINARY_DIR}/CMakeFiles/CMakeTmp/src.c"
|
FILE(WRITE "${CMAKE_BINARY_DIR}/CMakeFiles/CMakeTmp/src.c"
|
||||||
"${SOURCE}")
|
"${SOURCE}")
|
||||||
|
@ -15,10 +15,14 @@ MACRO(CHECK_CXX_SOURCE_COMPILES SOURCE VAR)
|
|||||||
IF(CMAKE_REQUIRED_LIBRARIES)
|
IF(CMAKE_REQUIRED_LIBRARIES)
|
||||||
SET(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES
|
SET(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES
|
||||||
"-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
|
"-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
|
||||||
|
ELSE(CMAKE_REQUIRED_LIBRARIES)
|
||||||
|
SET(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES)
|
||||||
ENDIF(CMAKE_REQUIRED_LIBRARIES)
|
ENDIF(CMAKE_REQUIRED_LIBRARIES)
|
||||||
IF(CMAKE_REQUIRED_INCLUDES)
|
IF(CMAKE_REQUIRED_INCLUDES)
|
||||||
SET(CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES
|
SET(CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES
|
||||||
"-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}")
|
"-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}")
|
||||||
|
ELSE(CMAKE_REQUIRED_INCLUDES)
|
||||||
|
SET(CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES)
|
||||||
ENDIF(CMAKE_REQUIRED_INCLUDES)
|
ENDIF(CMAKE_REQUIRED_INCLUDES)
|
||||||
FILE(WRITE "${CMAKE_BINARY_DIR}/CMakeFiles/CMakeTmp/src.cxx"
|
FILE(WRITE "${CMAKE_BINARY_DIR}/CMakeFiles/CMakeTmp/src.cxx"
|
||||||
"${SOURCE}")
|
"${SOURCE}")
|
||||||
|
@ -7,10 +7,16 @@
|
|||||||
#
|
#
|
||||||
# If CMAKE_REQUIRED_FLAGS is set then those flags will be passed into the
|
# If CMAKE_REQUIRED_FLAGS is set then those flags will be passed into the
|
||||||
# compile of the program
|
# 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)
|
MACRO(CHECK_INCLUDE_FILES INCLUDE VARIABLE)
|
||||||
IF("${VARIABLE}" MATCHES "^${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(CHECK_INCLUDE_FILES_CONTENT "/* */\n")
|
||||||
SET(MACRO_CHECK_INCLUDE_FILES_FLAGS ${CMAKE_REQUIRED_FLAGS})
|
SET(MACRO_CHECK_INCLUDE_FILES_FLAGS ${CMAKE_REQUIRED_FLAGS})
|
||||||
FOREACH(FILE ${INCLUDE})
|
FOREACH(FILE ${INCLUDE})
|
||||||
@ -28,6 +34,7 @@ MACRO(CHECK_INCLUDE_FILES INCLUDE VARIABLE)
|
|||||||
${CMAKE_BINARY_DIR}/CMakeFiles/CMakeTmp/CheckIncludeFiles.c
|
${CMAKE_BINARY_DIR}/CMakeFiles/CMakeTmp/CheckIncludeFiles.c
|
||||||
CMAKE_FLAGS
|
CMAKE_FLAGS
|
||||||
-DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_INCLUDE_FILES_FLAGS}
|
-DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_INCLUDE_FILES_FLAGS}
|
||||||
|
"${CHECK_INCLUDE_FILES_INCLUDE_DIRS}"
|
||||||
OUTPUT_VARIABLE OUTPUT)
|
OUTPUT_VARIABLE OUTPUT)
|
||||||
IF(${VARIABLE})
|
IF(${VARIABLE})
|
||||||
MESSAGE(STATUS "Looking for include files ${VARIABLE} - found")
|
MESSAGE(STATUS "Looking for include files ${VARIABLE} - found")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user