aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt24
1 files changed, 23 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a6ee3e9..0840b00 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,10 @@
project (uirc3 C)
cmake_minimum_required (VERSION 2.8.5)
+# Options
+option (WANT_READLINE "Use GNU Readline for the UI (better)" ON)
+option (WANT_EDITLINE "Use BSD libedit for the UI" OFF)
+
# Moar warnings
if ("${CMAKE_C_COMPILER_ID}" MATCHES "GNU" OR CMAKE_COMPILER_IS_GNUC)
# -Wunused-function is pretty annoying here, as everything is static
@@ -38,7 +42,25 @@ else (CURSES_FOUND)
message (SEND_ERROR "Curses not found")
endif (ncursesw_FOUND)
+if ((WANT_READLINE AND WANT_EDITLINE) OR (NOT WANT_READLINE AND NOT WANT_EDITLINE))
+ message (SEND_ERROR "You have to choose either GNU Readline or libedit")
+elseif (WANT_READLINE)
+ list (APPEND project_libraries readline)
+elseif (WANT_EDITLINE)
+ pkg_check_modules (libedit REQUIRED libedit)
+ list (APPEND project_libraries ${libedit_LIBRARIES})
+ include_directories (${libedit_INCLUDE_DIRS})
+endif ((WANT_READLINE AND WANT_EDITLINE) OR (NOT WANT_READLINE AND NOT WANT_EDITLINE))
+
# Generate a configuration file
+if (WANT_READLINE)
+ set (HAVE_READLINE 1)
+endif (WANT_READLINE)
+
+if (WANT_EDITLINE)
+ set (HAVE_EDITLINE 1)
+endif (WANT_EDITLINE)
+
include (GNUInstallDirs)
set (plugin_dir ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME})
configure_file (${PROJECT_SOURCE_DIR}/config.h.in ${PROJECT_BINARY_DIR}/config.h)
@@ -62,7 +84,7 @@ target_link_libraries (zyklonb ${project_libraries})
add_executable (degesch degesch.c kike-replies.c
${common_sources} ${common_headers})
-target_link_libraries (degesch ${project_libraries} readline)
+target_link_libraries (degesch ${project_libraries})
add_executable (kike kike.c kike-replies.c ${common_sources} ${common_headers})
target_link_libraries (kike ${project_libraries})