aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2021-11-02 15:33:10 +0100
committerPřemysl Eric Janouch <p@janouch.name>2021-11-02 15:34:51 +0100
commit851c2ee548c7963cd096dc8b152ca6cbdd772e3b (patch)
tree8b3d8b311e6fb8b8482bb37f022a80402c1f97b4
parentf9848ed6270de2ebd8e7bd32b7903ae4168d8fbf (diff)
downloadxK-851c2ee548c7963cd096dc8b152ca6cbdd772e3b.tar.gz
xK-851c2ee548c7963cd096dc8b152ca6cbdd772e3b.tar.xz
xK-851c2ee548c7963cd096dc8b152ca6cbdd772e3b.zip
CMakeLists.txt: fix macOS build
-rw-r--r--CMakeLists.txt8
1 files changed, 8 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ec97e26..d0dee46 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -61,6 +61,8 @@ 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)
+elseif (APPLE)
+ add_definitions (-D_DARWIN_C_SOURCE)
endif ()
# -lrt is only for glibc < 2.17
@@ -116,10 +118,16 @@ 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)
+ pkg_check_modules (readline readline)
+
# OpenBSD's default readline is too old
if ("${CMAKE_SYSTEM_NAME}" MATCHES "OpenBSD")
include_directories (${OPENBSD_LOCALBASE}/include/ereadline)
list (APPEND xC_libraries ereadline)
+ elseif (readline_FOUND)
+ list (APPEND xC_libraries ${readline_LIBRARIES})
+ include_directories (${readline_INCLUDE_DIRS})
+ link_directories (${readline_LIBRARY_DIRS})
else ()
list (APPEND xC_libraries readline)
endif ()