From 3daf254b41666a0835fc2d2bb22d56e7483e9e94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Eric=20Janouch?= Date: Thu, 29 Oct 2020 15:12:06 +0100 Subject: CMakeLists.txt: make this build in OpenBSD --- CMakeLists.txt | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c281ac5..69d0453 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,18 @@ set (project_libraries ${dependencies_LIBRARIES} include_directories (${dependencies_INCLUDE_DIRS} ${libssl_INCLUDE_DIRS} ${LIBEV_INCLUDE_DIRS}) +# -liconv may or may not be a part of libc +find_library (iconv_LIBRARIES iconv) +if (iconv_LIBRARIES) + list (APPEND project_libraries ${iconv_LIBRARIES}) +endif () + +if ("${CMAKE_SYSTEM_NAME}" MATCHES "BSD") + # Need this for SIGWINCH in FreeBSD and OpenBSD respectively; + # our POSIX version macros make it undefined + add_definitions (-D__BSD_VISIBLE=1 -D_BSD_SOURCE=1) +endif () + if (ncursesw_FOUND) list (APPEND project_libraries ${ncursesw_LIBRARIES}) include_directories (${ncursesw_INCLUDE_DIRS}) @@ -43,7 +55,13 @@ endif () if ((WANT_READLINE AND WANT_LIBEDIT) OR (NOT WANT_READLINE AND NOT WANT_LIBEDIT)) message (SEND_ERROR "You have to choose either GNU Readline or libedit") elseif (WANT_READLINE) - list (APPEND project_libraries readline) + # OpenBSD's default readline is too old + if ("${CMAKE_SYSTEM_NAME}" MATCHES "OpenBSD") + include_directories (${OPENBSD_LOCALBASE}/include/ereadline) + list (APPEND degesch_libraries ereadline) + else () + list (APPEND degesch_libraries readline) + endif () elseif (WANT_LIBEDIT) pkg_check_modules (libedit REQUIRED libedit) list (APPEND project_libraries ${libedit_LIBRARIES}) -- cgit v1.2.3