CheckIncludeFileCXX.cmake 1.4 KB

1234567891011121314151617181920212223242526272829303132
  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. CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${CMAKE_ANSI_CXXFLAGS}
  18. OUTPUT_VARIABLE OUTPUT)
  19. IF(${VARIABLE})
  20. MESSAGE(STATUS "Checking for CXX include file ${INCLUDE} -- found")
  21. SET(${VARIABLE} 1 CACHE INTERNAL "Have include ${INCLUDE}")
  22. ELSE(${VARIABLE})
  23. MESSAGE(STATUS "Checking for CXX include file ${INCLUDE} -- not found")
  24. SET(${VARIABLE} "" CACHE INTERNAL "Have include ${INCLUDE}")
  25. WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeError.log
  26. "Determining if the include file ${INCLUDE} "
  27. "exists failed with the following output:\n"
  28. "${OUTPUT}\n" APPEND)
  29. ENDIF(${VARIABLE})
  30. ENDIF("${VARIABLE}" MATCHES "^${VARIABLE}$")
  31. ENDMACRO(CHECK_INCLUDE_FILE_CXX)