Some systems (e.g. glibc < 2.17) require librt to get clock_gettime -> CMAKE

This commit is contained in:
Philippe Teuwen 2017-03-02 23:42:36 +01:00
parent 2d2a664f6c
commit b65674a8e3
2 changed files with 20 additions and 0 deletions

View file

@ -148,6 +148,22 @@ ENDIF(NOT WIN32)
INCLUDE(LibnfcDrivers) INCLUDE(LibnfcDrivers)
IF(UNIX AND NOT APPLE)
IF(I2C_REQUIRED)
# Inspired from http://cmake.3232098.n2.nabble.com/RFC-cmake-analog-to-AC-SEARCH-LIBS-td7585423.html
INCLUDE (CheckFunctionExists)
INCLUDE (CheckLibraryExists)
CHECK_FUNCTION_EXISTS (clock_gettime HAVE_CLOCK_GETTIME)
IF (NOT HAVE_CLOCK_GETTIME)
CHECK_LIBRARY_EXISTS (rt clock_gettime "" HAVE_CLOCK_GETTIME_IN_RT)
IF (HAVE_CLOCK_GETTIME_IN_RT)
SET(LIBRT_FOUND TRUE)
SET(LIBRT_LIBRARIES "rt")
ENDIF (HAVE_CLOCK_GETTIME_IN_RT)
ENDIF (NOT HAVE_CLOCK_GETTIME)
ENDIF(I2C_REQUIRED)
ENDIF(UNIX AND NOT APPLE)
IF(PCSC_INCLUDE_DIRS) IF(PCSC_INCLUDE_DIRS)
INCLUDE_DIRECTORIES(${PCSC_INCLUDE_DIRS}) INCLUDE_DIRECTORIES(${PCSC_INCLUDE_DIRS})
LINK_DIRECTORIES(${PCSC_LIBRARY_DIRS}) LINK_DIRECTORIES(${PCSC_LIBRARY_DIRS})

View file

@ -79,6 +79,10 @@ IF(LIBUSB_FOUND)
TARGET_LINK_LIBRARIES(nfc ${LIBUSB_LIBRARIES}) TARGET_LINK_LIBRARIES(nfc ${LIBUSB_LIBRARIES})
ENDIF(LIBUSB_FOUND) ENDIF(LIBUSB_FOUND)
IF(LIBRT_FOUND)
TARGET_LINK_LIBRARIES(nfc ${LIBRT_LIBRARIES})
ENDIF(LIBRT_FOUND)
SET_TARGET_PROPERTIES(nfc PROPERTIES SOVERSION 5 VERSION 5.0.1) SET_TARGET_PROPERTIES(nfc PROPERTIES SOVERSION 5 VERSION 5.0.1)
IF(WIN32) IF(WIN32)