summaryrefslogtreecommitdiff
path: root/src/FindReadline.cmake
blob: 67ea232829b011f743f54eb53313d07db349ceac (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
# - Find readline
#
#  READLINE_INCLUDE_DIRS - where to find curl/curl.h, etc.
#  READLINE_LIBRARIES    - List of libraries when using curl.
#  READLINE_FOUND        - True if curl found.

# Look for the header file.
FIND_PATH(READLINE_INCLUDE_DIR NAMES readline/readline.h)
MARK_AS_ADVANCED(READLINE_INCLUDE_DIR)

# Look for the library.
FIND_LIBRARY(READLINE_LIBRARY NAMES readline)
MARK_AS_ADVANCED(READLINE_LIBRARY)

# Copy the results to the output variables.
IF(READLINE_INCLUDE_DIR AND READLINE_LIBRARY)
  SET(READLINE_FOUND 1)
  SET(READLINE_LIBRARIES ${READLINE_LIBRARY})
  SET(READLINE_INCLUDE_DIRS ${READLINE_INCLUDE_DIR})
ELSE(READLINE_INCLUDE_DIR AND READLINE_LIBRARY)
  SET(READLINE_FOUND 0)
  SET(READLINE_LIBRARIES)
  SET(READLINE_INCLUDE_DIRS)
ENDIF(READLINE_INCLUDE_DIR AND READLINE_LIBRARY)

# Report the results.
IF(NOT READLINE_FOUND)
  SET(READLINE_DIR_MESSAGE
    "READLINE was not found. Make sure READLINE_LIBRARY and READLINE_INCLUDE_DIR are set.")
  IF(NOT READLINE_FIND_QUIETLY)
    MESSAGE(STATUS "${READLINE_DIR_MESSAGE}")
  ELSE(NOT READLINE_FIND_QUIETLY)
    IF(READLINE_FIND_REQUIRED)
      MESSAGE(FATAL_ERROR "${READLINE_DIR_MESSAGE}")
    ENDIF(READLINE_FIND_REQUIRED)
  ENDIF(NOT READLINE_FIND_QUIETLY)
ENDIF(NOT READLINE_FOUND)