This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/cmake/FindReadline.cmake

74 lines
2.3 KiB
CMake
Raw Normal View History

2014-12-14 12:05:43 +00:00
# - 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]
2014-12-14 12:05:43 +00:00
# Apple readline does not support readline hooks
# So we look for another one by default
2015-09-21 23:05:36 +01:00
#
# # try to extract R from readline to avoid collision
2014-12-14 12:05:43 +00:00
FIND_PATH(READLINE_INCLUDE_DIR NAMES readline/readline.h)
2014-12-14 12:05:43 +00:00
FIND_LIBRARY(READLINE_readline_LIBRARY NAMES readline)
2014-12-14 12:05:43 +00:00
# Sometimes readline really needs ncurses
FIND_LIBRARY(READLINE_ncurses_LIBRARY NAMES ncurses)
2017-11-10 23:08:35 +00:00
FIND_LIBRARY(READLINE_ncursesw_LIBRARY NAMES ncursesw)
# Sometimes ncurses really needs terminfo
FIND_LIBRARY(READLINE_tinfo_LIBRARY NAMES tinfo)
FIND_LIBRARY(READLINE_tinfow_LIBRARY NAMES tinfow)
2017-11-11 22:48:09 +00:00
# Apple readline does not support readline hooks
# So we look for another one by default
if ( READLINE_readline_LIBRARY)
set (HAVE_LIBREADLINE YES CACHE BOOL "ibReadline ACCESS")
endif()
IF(READLINE_readline_LIBRARY)
2017-11-10 23:08:35 +00:00
set(HAVE_LIBREADLINE CACHE YES BOOL "Readline works." )
SET( READLINE_LIBRARIES
2014-12-14 12:05:43 +00:00
${READLINE_readline_LIBRARY}
)
# some readline libraries depend on ncurses
IF(READLINE_ncurses_LIBRARY)
2017-11-10 23:08:35 +00:00
list(APPEND READLINE_LIBRARIES ${READLINE_ncurses_LIBRARY})
endif ()
# some readline libraries depend on ncurses
IF(READLINE_ncursesw_LIBRARY)
list(APPEND READLINE_LIBRARIES ${READLINE_ncursesw_LIBRARY})
endif ()
# some readline libraries depend on tinfo
IF(READLINE_tinfo_LIBRARY)
list(APPEND READLINE_LIBRARIES ${READLINE_tinfo_LIBRARY})
endif ()
# some readline libraries depend on tinfo
IF(READLINE_tinfow_LIBRARY)
list(APPEND READLINE_LIBRARIES ${READLINE_tinfow_LIBRARY})
endif ()
2014-12-14 12:05:43 +00:00
2017-11-11 22:48:09 +00:00
IF(READLINE_INCLUDE_DIR)
SET( READLINE_FOUND "YES" CACHE BOOL "Readline ACCESS.")
ENDIF(READLINE_INCLUDE_DIR)
2014-12-14 12:05:43 +00:00
ENDIF(READLINE_readline_LIBRARY)
2016-08-01 12:54:28 +01:00
2017-11-11 22:48:09 +00:00
message(STATUS "readline found: ${READLINE_FOUND}")
2016-08-01 12:54:28 +01:00
2017-11-11 22:48:09 +00:00
if (READLINE_FOUND)
message(STATUS "readline headers found at ${READLINE_INCLUDE_DIR}")
message(STATUS "readline library found at ${READLINE_LIBRARIES}")
endif()