1# 2# Checks whether this platform has a given preprocessor directive 3# 4# VARIABLE - variable to store the result to 5# 6 7get_filename_component(_CheckCPPDirective_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) 8 9macro(CHECK_CPP_DIRECTIVE_EXISTS DIRECTIVE VARIABLE) 10 if(NOT DEFINED "HAVE_${VARIABLE}") 11 message(STATUS "Checking to see if this platform has the ${DIRECTIVE} C-Preprocessor directive") 12 set(DIRECTIVE ${DIRECTIVE}) 13 configure_file(${_CheckCPPDirective_DIR}/CheckCPPDirectiveExists.cxx.in 14 ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeTmp/CheckCPPDirectiveExists.cxx) 15 try_compile(${VARIABLE} 16 ${CMAKE_BINARY_DIR} 17 ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeTmp/CheckCPPDirectiveExists.cxx 18 OUTPUT_VARIABLE OUTPUT) 19 if(${VARIABLE}) 20 set(HAVE_${VARIABLE} TRUE CACHE INTERNAL " ") 21 message(STATUS "Checking to see if this platform supports has the ${DIRECTIVE} C-Preprocessor directive - yes") 22 file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log 23 "Checking to see if this platform supports has the ${DIRECTIVE} C-Preprocessor directive with " 24 "the following output:\n${OUTPUT}\n\n") 25 else() 26 message(STATUS "Checking to see if this platform supports has the ${DIRECTIVE} C-Preprocessor directive - no") 27 file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log 28 "Checking to see if this platform supports has the ${DIRECTIVE} C-Preprocessor directive with " 29 "the following output:\n${OUTPUT}\n\n") 30 endif() 31 endif() 32endmacro() 33