From 851c2ee548c7963cd096dc8b152ca6cbdd772e3b Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch
Date: Tue, 2 Nov 2021 15:33:10 +0100 Subject: CMakeLists.txt: fix macOS build --- CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) 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 () -- cgit v1.2.3-70-g09d2