diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2020-10-29 15:12:06 +0100 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2020-10-30 04:21:16 +0100 |
commit | 3daf254b41666a0835fc2d2bb22d56e7483e9e94 (patch) | |
tree | 67200e55a94aafcfcaa776d3965900adf7f94a10 | |
parent | c533fa2fd7836c2dc019589ddedaa8bbade6cce3 (diff) | |
download | json-rpc-shell-3daf254b41666a0835fc2d2bb22d56e7483e9e94.tar.gz json-rpc-shell-3daf254b41666a0835fc2d2bb22d56e7483e9e94.tar.xz json-rpc-shell-3daf254b41666a0835fc2d2bb22d56e7483e9e94.zip |
CMakeLists.txt: make this build in OpenBSD
-rw-r--r-- | CMakeLists.txt | 20 |
1 files changed, 19 insertions, 1 deletions
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}) |