diff options
author | Tim Harder <radhermit@gmail.com> | 2011-07-01 17:39:03 +0200 |
---|---|---|
committer | Vicent Marti <tanoku@gmail.com> | 2011-07-01 17:41:46 +0200 |
commit | 1f4f4d17046e43ca24da9621323d921ae0d0f5dd (patch) | |
tree | 0441742a49d58768f3d6706b9593cbb0970100c2 /CMakeLists.txt | |
parent | ec62685345654cba50f3985c4ca44ce0e641d83c (diff) | |
download | libgit2-1f4f4d17046e43ca24da9621323d921ae0d0f5dd.tar.gz |
cmake: Use system zlib if found on non-Windows systems
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 4a7117b2d..d2d4f0fb6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,19 @@ STRING(REGEX REPLACE "^.*LIBGIT2_VERSION \"[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" SET(LIBGIT2_VERSION_STRING "${LIBGIT2_VERSION_MAJOR}.${LIBGIT2_VERSION_MINOR}.${LIBGIT2_VERSION_REV}") # Find required dependencies -INCLUDE_DIRECTORIES(deps/zlib src include) +INCLUDE_DIRECTORIES(src include) +IF (NOT WIN32) + FIND_PACKAGE(ZLIB) +ENDIF() + +IF (ZLIB_FOUND) + INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS}) + LINK_LIBRARIES(${ZLIB_LIBRARIES}) +ELSE (ZLIB_FOUND) + INCLUDE_DIRECTORIES(deps/zlib) + ADD_DEFINITIONS(-DNO_VIZ -DSTDC -DNO_GZIP) + FILE(GLOB SRC_ZLIB deps/zlib/*.c) +ENDIF() # Installation paths SET(INSTALL_BIN bin CACHE PATH "Where to install binaries to.") @@ -61,7 +73,6 @@ ENDIF() # Collect sourcefiles FILE(GLOB SRC src/*.c) -FILE(GLOB SRC_ZLIB deps/zlib/*.c) FILE(GLOB SRC_H include/git2/*.h) # On Windows use specific platform sources @@ -70,7 +81,7 @@ IF (WIN32 AND NOT CYGWIN) FILE(GLOB SRC src/*.c src/win32/*.c) ENDIF () -ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64 -DNO_VIZ -DSTDC -DNO_GZIP) +ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64) # Compile and link libgit2 ADD_LIBRARY(git2 ${SRC} ${SRC_ZLIB}) |