FindCARES.cmake 954 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # - Find c-ares
  2. # Find the c-ares includes and library
  3. # This module defines
  4. # CARES_INCLUDE_DIR, where to find ares.h, etc.
  5. # CARES_LIBRARIES, the libraries needed to use c-ares.
  6. # CARES_FOUND, If false, do not try to use c-ares.
  7. # also defined, but not for general use are
  8. # CARES_LIBRARY, where to find the c-ares library.
  9. find_path(CARES_INCLUDE_DIR ares.h
  10. /usr/local/include
  11. /usr/include
  12. )
  13. set(CARES_NAMES ${CARES_NAMES} cares)
  14. find_library(CARES_LIBRARY
  15. NAMES ${CARES_NAMES}
  16. PATHS /usr/lib /usr/local/lib
  17. )
  18. if(CARES_LIBRARY AND CARES_INCLUDE_DIR)
  19. set(CARES_LIBRARIES ${CARES_LIBRARY})
  20. set(CARES_FOUND "YES")
  21. else()
  22. set(CARES_FOUND "NO")
  23. endif()
  24. if(CARES_FOUND)
  25. if(NOT CARES_FIND_QUIETLY)
  26. message(STATUS "Found c-ares: ${CARES_LIBRARIES}")
  27. endif()
  28. else()
  29. if(CARES_FIND_REQUIRED)
  30. message(FATAL_ERROR "Could not find c-ares library")
  31. endif()
  32. endif()
  33. mark_as_advanced(
  34. CARES_LIBRARY
  35. CARES_INCLUDE_DIR
  36. )