aboutsummaryrefslogtreecommitdiff
path: root/cmake/FindReadline.cmake
diff options
context:
space:
mode:
authorJethro Grassie <jtg@xtrabass.com>2018-01-11 00:50:41 -0500
committerJethro Grassie <jtg@xtrabass.com>2018-01-11 13:51:13 -0500
commitbe1826c0fbd9ce665d93c3300d4106ea9bcbeafb (patch)
tree712dc769e95c24683260bbe385ef0f8969d9385a /cmake/FindReadline.cmake
parentMerge pull request #3091 (diff)
downloadmonero-be1826c0fbd9ce665d93c3300d4106ea9bcbeafb.tar.xz
Keep readline optional
Diffstat (limited to 'cmake/FindReadline.cmake')
-rw-r--r--cmake/FindReadline.cmake12
1 files changed, 10 insertions, 2 deletions
diff --git a/cmake/FindReadline.cmake b/cmake/FindReadline.cmake
index 7a11a270a..87f8ccace 100644
--- a/cmake/FindReadline.cmake
+++ b/cmake/FindReadline.cmake
@@ -15,8 +15,11 @@
#
# READLINE_FOUND System has readline, include and lib dirs found
# GNU_READLINE_FOUND Version of readline found is GNU readline, not libedit!
+# LIBEDIT_FOUND Version of readline found is libedit, not GNU readline!
# Readline_INCLUDE_DIR The readline include directories.
# Readline_LIBRARY The readline library.
+# GNU_READLINE_LIBRARY The GNU readline library or empty string.
+# LIBEDIT_LIBRARY The libedit library or empty string.
find_path(Readline_ROOT_DIR
NAMES include/readline/readline.h
@@ -63,7 +66,6 @@ check_function_exists(rl_copy_text HAVE_COPY_TEXT)
check_function_exists(rl_filename_completion_function HAVE_COMPLETION_FUNCTION)
if(NOT HAVE_COMPLETION_FUNCTION)
- unset(READLINE_FOUND)
set(CMAKE_REQUIRED_LIBRARIES ${Readline_LIBRARY} ${Termcap_LIBRARY})
check_function_exists(rl_copy_text HAVE_COPY_TEXT_TC)
check_function_exists(rl_filename_completion_function HAVE_COMPLETION_FUNCTION_TC)
@@ -74,8 +76,14 @@ if(NOT HAVE_COMPLETION_FUNCTION)
endif(HAVE_COMPLETION_FUNCTION)
endif(NOT HAVE_COMPLETION_FUNCTION)
+set(LIBEDIT_LIBRARY "")
+set(GNU_READLINE_LIBRARY "")
+
if(HAVE_COMPLETION_FUNCTION AND HAVE_COPY_TEXT)
set(GNU_READLINE_FOUND TRUE)
- set(READLINE_FOUND TRUE)
+ set(GNU_READLINE_LIBRARY ${Readline_LIBRARY})
+elseif(READLINE_FOUND AND NOT HAVE_COPY_TEXT)
+ set(LIBEDIT_FOUND TRUE)
+ set(LIBEDIT_LIBRARY ${Readline_LIBRARY})
endif(HAVE_COMPLETION_FUNCTION AND HAVE_COPY_TEXT)