From 946c75641414102b5c0aec4b1c27a4bff83fe442 Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Sun, 7 Jul 2024 05:44:09 +0200 Subject: [PATCH] cmake: add epoll-shim for some BSDs ld: error: undefined reference due to --no-allow-shlib-undefined: timerfd_create >>> referenced by libaquamarine.so.0.1.0 --- CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index c9f1eb9..81871cc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,7 @@ project(aquamarine ) include(CTest) +include(CheckIncludeFile) include(GNUInstallDirs) set(PREFIX ${CMAKE_INSTALL_PREFIX}) @@ -52,6 +53,12 @@ set_target_properties(aquamarine PROPERTIES ) target_link_libraries(aquamarine PkgConfig::deps) +check_include_file("sys/timerfd.h" HAS_TIMERFD) +pkg_check_modules(epoll IMPORTED_TARGET epoll-shim) +if(NOT HAS_TIMERFD AND epoll_FOUND) + target_link_libraries(aquamarine PkgConfig::epoll) +endif() + # Protocols pkg_get_variable(WAYLAND_PROTOCOLS_DIR wayland-protocols pkgdatadir) message(STATUS "Found wayland-protocols at ${WAYLAND_PROTOCOLS_DIR}")