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
Vitor Santos Costa d93134dcf6 Makefiles
2017-10-17 00:13:09 +01:00

68 lines
2.1 KiB
CMake

# - 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
#
# # try to extract R from readline to avoid collision
FIND_PATH(READLINE_INCLUDE_DIR NAMES readline/readline.h)
# Apple readline does not support readline hooks
# So we look for another one by default
FIND_LIBRARY(READLINE_readline_LIBRARY NAMES readline)
# Sometimes readline really needs ncurses
FIND_LIBRARY(READLINE_ncurses_LIBRARY NAMES ncurses)
MARK_AS_ADVANCED(
READLINE_INCLUDE_DIR
READLINE_readline_LIBRARY
READLINE_ncurses_LIBRARY
)
message(STATUS "readline headers found at ${READLINE_INCLUDE_DIR}")
message(STATUS "readline library found at ${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)
set(HAVE_LIBREADLINE 0 CACHE BOOL "Readline works.")
IF(READLINE_FOUND)
MESSAGE(STATUS "Found readline library")
set(HAVE_LIBREADLINE 1)
ELSE(READLINE_FOUND)
IF(READLINE_FIND_REQUIRED)
MESSAGE(SYSTEM_ERROR_FATAL "Could not find readline -- please give some paths to CMake")
ENDIF(READLINE_FIND_REQUIRED)
ENDIF(READLINE_FOUND)
find_package_handle_standard_args(Readline READLINE_INCLUDE_DIR READLINE_LIBRARIES READLINE_readline_LIBRARY READLINE_ncurses_LIBRARY)
MARK_AS_ADVANCED(
READLINE_FOUND
HAVE_LIBREADLINE
)