diff --git a/CMakeLists.txt b/CMakeLists.txt index f5d1f7a..76babf2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -148,6 +148,22 @@ ENDIF(NOT WIN32) 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) INCLUDE_DIRECTORIES(${PCSC_INCLUDE_DIRS}) LINK_DIRECTORIES(${PCSC_LIBRARY_DIRS}) diff --git a/libnfc/CMakeLists.txt b/libnfc/CMakeLists.txt index e69f614..79bab5d 100644 --- a/libnfc/CMakeLists.txt +++ b/libnfc/CMakeLists.txt @@ -79,6 +79,10 @@ IF(LIBUSB_FOUND) TARGET_LINK_LIBRARIES(nfc ${LIBUSB_LIBRARIES}) 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) IF(WIN32)