diff options
author | Tobias Marquardt <tm@tobix.eu> | 2014-02-21 01:09:44 +0100 |
---|---|---|
committer | Tobias Marquardt <tm@tobix.eu> | 2014-02-21 01:20:31 +0100 |
commit | 5bda607c37e99d7257ace09fd8685b52d5f6ae85 (patch) | |
tree | 1b6ef08b763ae391f39aabf49935e1f90e2915c6 /CMakeLists.txt | |
parent | 2dc49ea93c5c320216806089fee579021f3ce9cf (diff) | |
download | libgit2-5bda607c37e99d7257ace09fd8685b52d5f6ae85.tar.gz |
Check if librt exists independent of OS, to be able to exclude librt on Android builds, even though it is a 'Linux'.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f2a2bb82..d6b327503 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,6 +17,8 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6) # Add find modules to the path SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/cmake/Modules/") +INCLUDE(CheckLibraryExists) + # Build options # OPTION( SONAME "Set the (SO)VERSION of the target" ON ) @@ -78,7 +80,9 @@ FUNCTION(TARGET_OS_LIBRARIES target) ELSEIF(CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)") TARGET_LINK_LIBRARIES(${target} socket nsl) SET(LIBGIT2_PC_LIBS "${LIBGIT2_PC_LIBS} -lsocket -lnsl" PARENT_SCOPE) - ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Linux") + ENDIF() + CHECK_LIBRARY_EXISTS(rt clock_gettime "time.h" NEED_LIBRT) + IF(NEED_LIBRT) TARGET_LINK_LIBRARIES(${target} rt) SET(LIBGIT2_PC_LIBS "${LIBGIT2_PC_LIBS} -lrt" PARENT_SCOPE) ENDIF() |