degesch: add support for libedit

Just another kind of evil.
This commit is contained in:
2015-05-05 08:46:59 +02:00
parent 53894e3909
commit a5a1079a9c
4 changed files with 476 additions and 71 deletions

View File

@@ -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})