Link with -lrt for older glibc

Quoted from Linux Programmer's Manual (2017-09-15):
    #include <time.h>
    int clock_gettime(clockid_t clk_id, struct timespec *tp);
    Link with -lrt (only for glibc versions before 2.17).

This patch adds additional checks for librt availability and append
target_link_libraries accordingly. librt is absent on macOS.

Fixed #139
This commit is contained in:
Jim Huang 2019-08-24 21:24:56 +08:00
parent 7f29dec44a
commit 99e071cf2c

View File

@ -108,6 +108,10 @@ if(WIN32)
list(APPEND mi_libraries psapi shell32 user32)
else()
list(APPEND mi_libraries pthread)
find_library(LIBRT rt)
if(LIBRT)
list(APPEND mi_libraries ${LIBRT})
endif()
endif()
# -----------------------------------------------------------------------------