link librt if needed for shm_open
authorFelix Fietkau <nbd@nbd.name>
Tue, 28 Nov 2023 21:09:24 +0000 (22:09 +0100)
committerFelix Fietkau <nbd@nbd.name>
Tue, 28 Nov 2023 21:10:43 +0000 (22:10 +0100)
Signed-off-by: Felix Fietkau <nbd@nbd.name>
CMakeLists.txt

index 1a6ff584a337f115cc31b04c3e77af6a8eb35d92..74a87fa222229539fef854b784d605dd0d8b2403 100644 (file)
@@ -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()