2003-01-02 02:00:49 +03:00
|
|
|
#
|
|
|
|
# Check if the files can be included
|
|
|
|
#
|
|
|
|
# CHECK_INCLUDE_FILES - macro which checks the include file exists.
|
|
|
|
# INCLUDE - list of files to include
|
|
|
|
# VARIABLE - variable to return result
|
|
|
|
#
|
|
|
|
|
|
|
|
MACRO(CHECK_INCLUDE_FILES INCLUDE VARIABLE)
|
|
|
|
IF("${VARIABLE}" MATCHES "^${VARIABLE}$")
|
|
|
|
SET(CHECK_INCLUDE_FILES_CONTENT "/* */\n")
|
2003-01-04 03:23:19 +03:00
|
|
|
SET(MACRO_CHECK_INCLUDE_FILES_FLAGS ${CMAKE_REQUIRED_FLAGS})
|
2003-01-02 02:00:49 +03:00
|
|
|
FOREACH(FILE ${INCLUDE})
|
|
|
|
SET(CHECK_INCLUDE_FILES_CONTENT
|
2003-07-11 22:14:03 +04:00
|
|
|
"${CHECK_INCLUDE_FILES_CONTENT}#include <${FILE}>\n")
|
2003-01-02 02:00:49 +03:00
|
|
|
ENDFOREACH(FILE)
|
|
|
|
SET(CHECK_INCLUDE_FILES_CONTENT
|
2003-07-11 22:14:03 +04:00
|
|
|
"${CHECK_INCLUDE_FILES_CONTENT}\n\nint main(){return 0;}\n")
|
|
|
|
FILE(WRITE ${CMAKE_BINARY_DIR}/CMakeTmp/CheckIncludeFiles.c
|
|
|
|
"${CHECK_INCLUDE_FILES_CONTENT}")
|
|
|
|
|
2003-01-21 22:01:41 +03:00
|
|
|
MESSAGE(STATUS "Looking for include files ${VARIABLE}")
|
2003-01-02 02:00:49 +03:00
|
|
|
TRY_COMPILE(${VARIABLE}
|
2003-07-11 22:14:03 +04:00
|
|
|
${CMAKE_BINARY_DIR}
|
|
|
|
${CMAKE_BINARY_DIR}/CMakeTmp/CheckIncludeFiles.c
|
|
|
|
CMAKE_FLAGS
|
|
|
|
-DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_INCLUDE_FILES_FLAGS}
|
|
|
|
OUTPUT_VARIABLE OUTPUT)
|
2003-01-02 02:00:49 +03:00
|
|
|
IF(${VARIABLE})
|
2003-01-21 22:01:41 +03:00
|
|
|
MESSAGE(STATUS "Looking for include files ${VARIABLE} - found")
|
|
|
|
SET(${VARIABLE} 1 CACHE INTERNAL "Have include ${VARIABLE}")
|
2003-01-02 02:00:49 +03:00
|
|
|
ELSE(${VARIABLE})
|
2003-01-21 22:01:41 +03:00
|
|
|
MESSAGE(STATUS "Looking for include files ${VARIABLE} - not found.")
|
|
|
|
SET(${VARIABLE} "" CACHE INTERNAL "Have includes ${VARIABLE}")
|
2003-07-11 22:14:03 +04:00
|
|
|
FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeError.log
|
2003-01-02 02:00:49 +03:00
|
|
|
"Determining if files ${INCLUDE} "
|
|
|
|
"exist failed with the following output:\n"
|
2003-07-17 22:55:45 +04:00
|
|
|
"${OUTPUT}\n\n")
|
2003-01-02 02:00:49 +03:00
|
|
|
ENDIF(${VARIABLE})
|
|
|
|
ENDIF("${VARIABLE}" MATCHES "^${VARIABLE}$")
|
|
|
|
ENDMACRO(CHECK_INCLUDE_FILES)
|