summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt37
1 files changed, 28 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fdbc45f..8170ce2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -27,19 +27,32 @@ pkg_check_modules (libssl REQUIRED libssl libcrypto)
pkg_check_modules (ncursesw ncursesw)
if ("${CMAKE_SYSTEM_NAME}" MATCHES "BSD")
- # iconv() doesn't have to be present in libc
- # FIXME: detect if we need the library independently on the platform
- list (APPEND project_libraries iconv)
- # Need this for SIGWINCH; our POSIX version macros make it undefined
- add_definitions (-D__BSD_VISIBLE=1)
+ include_directories(/usr/local/include)
+ link_directories(/usr/local/lib)
+ # 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 ("${CMAKE_SYSTEM_NAME}" MATCHES "BSD")
-# -lpthread is only there for debugging (gdb & errno)
-# -lrt is only for glibc < 2.17
-list (APPEND project_libraries ${libssl_LIBRARIES} rt pthread)
+# iconv may or may not be present in libc
+find_library (iconv_LIBRARIES iconv)
+if (iconv_LIBRARIES)
+ list (APPEND project_libraries ${iconv_LIBRARIES})
+endif (iconv_LIBRARIES)
+
+list (APPEND project_libraries ${libssl_LIBRARIES})
include_directories (${libssl_INCLUDE_DIRS})
link_directories (${libssl_LIBRARY_DIRS})
+# -lpthread is only there for debugging (gdb & errno)
+# -lrt is only for glibc < 2.17
+foreach (extra rt pthread)
+ find_library (extra_lib ${extra})
+ if (extra_lib)
+ list (APPEND project_libraries ${extra})
+ endif (extra_lib)
+endforeach (extra)
+
if (ncursesw_FOUND)
list (APPEND project_libraries ${ncursesw_LIBRARIES})
include_directories (${ncursesw_INCLUDE_DIRS})
@@ -53,7 +66,13 @@ endif (ncursesw_FOUND)
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 (/usr/local/include/ereadline)
+ list (APPEND project_libraries ereadline)
+ else ("${CMAKE_SYSTEM_NAME}" MATCHES "OpenBSD")
+ list (APPEND project_libraries readline)
+ endif ("${CMAKE_SYSTEM_NAME}" MATCHES "OpenBSD")
elseif (WANT_LIBEDIT)
pkg_check_modules (libedit REQUIRED libedit)
list (APPEND project_libraries ${libedit_LIBRARIES})