CheckFunctionExists.cmake 703 B

1234567891011121314151617181920
  1. #
  2. # Check if the function exists.
  3. #
  4. # CHECK_FUNCTION_EXISTS - macro which checks if the function exists
  5. # FUNCTION - the name of the function
  6. # VARIABLE - variable to store the result
  7. #
  8. MACRO(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE)
  9. TRY_COMPILE(${VARIABLE}
  10. ${PROJECT_BINARY_DIR}
  11. ${CMAKE_ROOT}/Modules/CheckFunctionExists.c
  12. COMPILE_DEFINITIONS -DCHECK_FUNCTION_EXISTS=${FUNCTION}
  13. OUTPUT_VARIABLE OUTPUT)
  14. IF(NOT ${VARIABLE})
  15. WRITE_FILE(${PROJECT_BINARY_DIR}/CMakeError.log
  16. "Determining if the function ${FUNCTION} exists failed with the following output:\n"
  17. "${OUTPUT}\n")
  18. ENDIF(NOT ${VARIABLE})
  19. ENDMACRO(CHECK_FUNCTION_EXISTS)