CMake: build-time test - backwards compatibility with older glibc (#1467)

This commit is contained in:
tuxuser 2022-05-25 07:46:34 +02:00 committed by LordGrey
parent fdab2586a5
commit 7c76322215

View File

@ -139,6 +139,22 @@ if (ENABLE_DEV_USB_HID)
else()
target_link_libraries(leddevice ${LIBUSB_1_LIBRARIES} hidapi-libusb)
endif()
if(NOT WIN32)
include(CheckCSourceCompiles)
# Glibc compatibilty check
check_c_source_compiles("
#include <time.h>
#include <sys/time.h>
int main() {
struct timespec t;
return clock_gettime(CLOCK_REALTIME, &t);
}
" GLIBC_HAS_CLOCK_GETTIME)
IF(NOT GLIBC_HAS_CLOCK_GETTIME)
target_link_libraries(leddevice rt)
endif()
endif()
endif()
if(ENABLE_MDNS)