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
This commit is contained in:
Jan Beich 2024-07-07 05:44:09 +02:00 committed by Mihai Fufezan
parent 92b4b01501
commit 946c756414

View file

@ -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}")