From e80dc00ee90c29ef56ae28f414b0e5bb361206e7 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 28 Nov 2023 22:09:24 +0100 Subject: [PATCH] link librt if needed for shm_open Signed-off-by: Felix Fietkau --- CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1a6ff58..74a87fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,9 +29,11 @@ SET_TARGET_PROPERTIES(ubox-static PROPERTIES OUTPUT_NAME ubox) SET(LIBS) CHECK_FUNCTION_EXISTS(clock_gettime HAVE_GETTIME) -IF(NOT HAVE_GETTIME) +CHECK_FUNCTION_EXISTS(shm_open HAVE_SHM) +IF(NOT HAVE_GETTIME OR NOT HAVE_SHM) CHECK_LIBRARY_EXISTS(rt clock_gettime "" NEED_GETTIME) - IF(NEED_GETTIME) + CHECK_LIBRARY_EXISTS(rt shm_open "" NEED_SHM) + IF(NEED_GETTIME OR NEED_SHM) TARGET_LINK_LIBRARIES(ubox rt) ENDIF() ENDIF()