link librt if needed for shm_open

Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
Felix Fietkau 2023-11-28 22:09:24 +01:00
parent 260ad5bd15
commit e80dc00ee9

View file

@ -29,9 +29,11 @@ SET_TARGET_PROPERTIES(ubox-static PROPERTIES OUTPUT_NAME ubox)
SET(LIBS) SET(LIBS)
CHECK_FUNCTION_EXISTS(clock_gettime HAVE_GETTIME) 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) 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) TARGET_LINK_LIBRARIES(ubox rt)
ENDIF() ENDIF()
ENDIF() ENDIF()