1
0

CheckIncludeFileCXX.cmake 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  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. FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeOutput.log
  22. "Determining if the include file ${INCLUDE} "
  23. "exists passed with the following output:\n"
  24. "${OUTPUT}\n\n")
  25. ELSE(${VARIABLE})
  26. MESSAGE(STATUS "Checking for CXX include file ${INCLUDE} -- not found")
  27. SET(${VARIABLE} "" CACHE INTERNAL "Have include ${INCLUDE}")
  28. FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeError.log
  29. "Determining if the include file ${INCLUDE} "
  30. "exists failed with the following output:\n"
  31. "${OUTPUT}\n\n")
  32. ENDIF(${VARIABLE})
  33. ENDIF("${VARIABLE}" MATCHES "^${VARIABLE}$")
  34. ENDMACRO(CHECK_INCLUDE_FILE_CXX)