summaryrefslogtreecommitdiff
path: root/CMake/FindCARES.cmake
blob: c4ab5f132209be9790d6baca5f21336d74cbc2d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# - Find c-ares
# Find the c-ares includes and library
# This module defines
#  CARES_INCLUDE_DIR, where to find ares.h, etc.
#  CARES_LIBRARIES, the libraries needed to use c-ares.
#  CARES_FOUND, If false, do not try to use c-ares.
# also defined, but not for general use are
# CARES_LIBRARY, where to find the c-ares library.

FIND_PATH(CARES_INCLUDE_DIR ares.h
  /usr/local/include
  /usr/include
  )

SET(CARES_NAMES ${CARES_NAMES} cares)
FIND_LIBRARY(CARES_LIBRARY
  NAMES ${CARES_NAMES}
  PATHS /usr/lib /usr/local/lib
  )

IF (CARES_LIBRARY AND CARES_INCLUDE_DIR)
  SET(CARES_LIBRARIES ${CARES_LIBRARY})
  SET(CARES_FOUND "YES")
ELSE (CARES_LIBRARY AND CARES_INCLUDE_DIR)
  SET(CARES_FOUND "NO")
ENDIF (CARES_LIBRARY AND CARES_INCLUDE_DIR)


IF (CARES_FOUND)
  IF (NOT CARES_FIND_QUIETLY)
    MESSAGE(STATUS "Found c-ares: ${CARES_LIBRARIES}")
  ENDIF (NOT CARES_FIND_QUIETLY)
ELSE (CARES_FOUND)
  IF (CARES_FIND_REQUIRED)
    MESSAGE(FATAL_ERROR "Could not find c-ares library")
  ENDIF (CARES_FIND_REQUIRED)
ENDIF (CARES_FOUND)

MARK_AS_ADVANCED(
  CARES_LIBRARY
  CARES_INCLUDE_DIR
  )