File: FindReadline.cmake

package info (click to toggle)
tasksh 1.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, forky, sid, trixie
  • size: 1,976 kB
  • ctags: 843
  • sloc: cpp: 11,313; makefile: 3
file content (81 lines) | stat: -rw-r--r-- 2,309 bytes parent folder | download | duplicates (3)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# - Find the readline library
# This module defines
#  READLINE_INCLUDE_DIR, path to readline/readline.h, etc.
#  READLINE_LIBRARIES, the libraries required to use READLINE.
#  READLINE_FOUND, If false, do not try to use READLINE.
# also defined, but not for general use are
# READLINE_readline_LIBRARY, where to find the READLINE library.
# READLINE_ncurses_LIBRARY, where to find the ncurses library [might not be defined]

# Apple readline does not support readline hooks
# So we look for another one by default
IF (APPLE OR FREEBSD)
  FIND_PATH (READLINE_INCLUDE_DIR NAMES readline/readline.h PATHS
    /usr/include/
    /sw/include
    /opt/local/include
    /opt/include
    /usr/local/include
    NO_DEFAULT_PATH
    )
ENDIF (APPLE OR FREEBSD)
FIND_PATH (READLINE_INCLUDE_DIR NAMES readline/readline.h)


# Apple readline does not support readline hooks
# So we look for another one by default
IF (APPLE OR FREEBSD)
  FIND_LIBRARY (READLINE_readline_LIBRARY NAMES readline PATHS
    /usr/lib
    /sw/lib
    /opt/local/lib
    /opt/lib
    /usr/local/lib
    NO_DEFAULT_PATH
    )
ENDIF (APPLE OR FREEBSD)
FIND_LIBRARY (READLINE_readline_LIBRARY NAMES readline)

# Sometimes readline really needs ncurses
IF (APPLE OR FREEBSD)
  FIND_LIBRARY (READLINE_ncurses_LIBRARY NAMES ncurses PATHS
    /usr/lib
    /sw/lib
    /opt/local/lib
    /opt/lib
    /usr/local/lib
    /usr/lib
    NO_DEFAULT_PATH
    )
ENDIF (APPLE OR FREEBSD)
FIND_LIBRARY (READLINE_ncurses_LIBRARY NAMES ncurses)

MARK_AS_ADVANCED (
  READLINE_INCLUDE_DIR
  READLINE_readline_LIBRARY
  READLINE_ncurses_LIBRARY
  )

SET (READLINE_FOUND "NO" )
IF (READLINE_INCLUDE_DIR)
  IF (READLINE_readline_LIBRARY)
    SET (READLINE_FOUND "YES" )
    SET (READLINE_LIBRARIES
      ${READLINE_readline_LIBRARY} 
      )

    # some readline libraries depend on ncurses
    IF (READLINE_ncurses_LIBRARY)
      SET (READLINE_LIBRARIES ${READLINE_LIBRARIES} ${READLINE_ncurses_LIBRARY})
    ENDIF (READLINE_ncurses_LIBRARY)

  ENDIF (READLINE_readline_LIBRARY)
ENDIF (READLINE_INCLUDE_DIR)

IF (READLINE_FOUND)
  MESSAGE (STATUS "Found readline library")
ELSE (READLINE_FOUND)
  IF (READLINE_FIND_REQUIRED)
    MESSAGE (FATAL_ERROR "Could not find readline -- please give some paths to CMake")
  ENDIF (READLINE_FIND_REQUIRED)
ENDIF (READLINE_FOUND)