summaryrefslogtreecommitdiff
path: root/src/FindReadline.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'src/FindReadline.cmake')
-rw-r--r--src/FindReadline.cmake37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/FindReadline.cmake b/src/FindReadline.cmake
new file mode 100644
index 0000000..67ea232
--- /dev/null
+++ b/src/FindReadline.cmake
@@ -0,0 +1,37 @@
+# - Find readline
+#
+# READLINE_INCLUDE_DIRS - where to find curl/curl.h, etc.
+# READLINE_LIBRARIES - List of libraries when using curl.
+# READLINE_FOUND - True if curl found.
+
+# Look for the header file.
+FIND_PATH(READLINE_INCLUDE_DIR NAMES readline/readline.h)
+MARK_AS_ADVANCED(READLINE_INCLUDE_DIR)
+
+# Look for the library.
+FIND_LIBRARY(READLINE_LIBRARY NAMES readline)
+MARK_AS_ADVANCED(READLINE_LIBRARY)
+
+# Copy the results to the output variables.
+IF(READLINE_INCLUDE_DIR AND READLINE_LIBRARY)
+ SET(READLINE_FOUND 1)
+ SET(READLINE_LIBRARIES ${READLINE_LIBRARY})
+ SET(READLINE_INCLUDE_DIRS ${READLINE_INCLUDE_DIR})
+ELSE(READLINE_INCLUDE_DIR AND READLINE_LIBRARY)
+ SET(READLINE_FOUND 0)
+ SET(READLINE_LIBRARIES)
+ SET(READLINE_INCLUDE_DIRS)
+ENDIF(READLINE_INCLUDE_DIR AND READLINE_LIBRARY)
+
+# Report the results.
+IF(NOT READLINE_FOUND)
+ SET(READLINE_DIR_MESSAGE
+ "READLINE was not found. Make sure READLINE_LIBRARY and READLINE_INCLUDE_DIR are set.")
+ IF(NOT READLINE_FIND_QUIETLY)
+ MESSAGE(STATUS "${READLINE_DIR_MESSAGE}")
+ ELSE(NOT READLINE_FIND_QUIETLY)
+ IF(READLINE_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "${READLINE_DIR_MESSAGE}")
+ ENDIF(READLINE_FIND_REQUIRED)
+ ENDIF(NOT READLINE_FIND_QUIETLY)
+ENDIF(NOT READLINE_FOUND)