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

94 lines
2.5 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]
2015-09-21 23:05:36 +01:00
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
IF(APPLE)
FIND_PATH(READLINE_INCLUDE_DIR NAMES readline/readline.h PATHS
2015-09-21 23:05:36 +01:00
${R_INCLUDE_DIR}
2014-12-14 12:05:43 +00:00
/sw/include
/opt/local/include
/opt/include
2015-09-21 23:05:36 +01:00
/usr/local/opt/readline/include #brew
2014-12-14 12:05:43 +00:00
/usr/local/include
/usr/include/
NO_DEFAULT_PATH
)
ENDIF(APPLE)
FIND_PATH(READLINE_INCLUDE_DIR NAMES readline/readline.h)
2014-12-14 12:05:43 +00:00
# Apple readline does not support readline hooks
# So we look for another one by default
IF(APPLE)
2015-09-21 23:05:36 +01:00
FIND_LIBRARY(READLINE_readline_LIBRARY NAMES readline PATHS
2014-12-14 12:05:43 +00:00
/sw/lib
/opt/local/lib
2015-09-21 23:05:36 +01:00
/usr/local/opt/readline/lib #brew
2014-12-14 12:05:43 +00:00
/opt/lib
/usr/local/lib
/usr/lib
NO_DEFAULT_PATH
)
ENDIF(APPLE)
FIND_LIBRARY(READLINE_readline_LIBRARY NAMES readline)
2014-12-14 12:05:43 +00:00
# Sometimes readline really needs ncurses
IF(APPLE)
FIND_LIBRARY(READLINE_ncurses_LIBRARY NAMES ncurses PATHS
/sw/lib
/opt/local/lib
/opt/lib
/usr/local/lib
/usr/lib
NO_DEFAULT_PATH
)
ENDIF(APPLE)
FIND_LIBRARY(READLINE_ncurses_LIBRARY NAMES ncurses)
2014-12-14 12:05:43 +00:00
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)
2015-09-25 10:57:26 +01:00
MESSAGE(SYSTEM_ERROR_FATAL "Could not find readline -- please give some paths to CMake")
2014-12-14 12:05:43 +00:00
ENDIF(READLINE_FIND_REQUIRED)
ENDIF(READLINE_FOUND)
2016-08-01 12:54:28 +01:00
find_package_handle_standard_args(Readline READLINE_INCLUDE_DIR READLINE_LIBRARIES READLINE_readline_LIBRARY READLINE_ncurses_LIBRARY)
MARK_AS_ADVANCED(
READLINE_FOUND
)