CheckIncludeFileCXX.cmake 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. #
  2. # Check if the include file exists.
  3. #
  4. # CHECK_INCLUDE_FILE - macro which checks the include file exists.
  5. # INCLUDE - name of include file
  6. # VARIABLE - variable to return result
  7. #
  8. MACRO(CHECK_INCLUDE_FILE_CXX INCLUDE VARIABLE)
  9. IF("${VARIABLE}" MATCHES "^${VARIABLE}$")
  10. MESSAGE(STATUS "Checking for CXX include file ${INCLUDE}")
  11. SET(CHECK_INCLUDE_FILE_VAR ${INCLUDE})
  12. CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CheckIncludeFile.cxx.in
  13. ${CMAKE_BINARY_DIR}/CMakeTmp/CheckIncludeFile.cxx IMMEDIATE)
  14. TRY_COMPILE(${VARIABLE}
  15. ${CMAKE_BINARY_DIR}
  16. ${CMAKE_BINARY_DIR}/CMakeTmp/CheckIncludeFile.cxx
  17. OUTPUT_VARIABLE OUTPUT)
  18. IF(${VARIABLE})
  19. MESSAGE(STATUS "Checking for CXX include file ${INCLUDE} -- found")
  20. SET(${VARIABLE} 1 CACHE INTERNAL "Have include ${INCLUDE}")
  21. ELSE(${VARIABLE})
  22. MESSAGE(STATUS "Checking for CXX include file ${INCLUDE} -- not found")
  23. SET(${VARIABLE} "" CACHE INTERNAL "Have include ${INCLUDE}")
  24. FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeError.log
  25. "Determining if the include file ${INCLUDE} "
  26. "exists failed with the following output:\n"
  27. "${OUTPUT}\n\n")
  28. ENDIF(${VARIABLE})
  29. ENDIF("${VARIABLE}" MATCHES "^${VARIABLE}$")
  30. ENDMACRO(CHECK_INCLUDE_FILE_CXX)