diff options
| author | Yoichi Nakayama <yoichi.nakayama@gmail.com> | 2021-11-23 10:12:29 +0900 |
|---|---|---|
| committer | Yoichi Nakayama <yoichi.nakayama@gmail.com> | 2021-11-23 10:20:04 +0900 |
| commit | 7bb206a76dca70b7db236315d348c6c9fc325cab (patch) | |
| tree | e38bb2d225746de8343db08837840e84aad3ece0 /cmake/SelectZlib.cmake | |
| parent | 540b02f3b97baf2bc1d62210a23d522b5d73e5eb (diff) | |
| parent | f9c4dc10d90732cfbe2271dd58b01dd8f4003d15 (diff) | |
| download | libgit2-7bb206a76dca70b7db236315d348c6c9fc325cab.tar.gz | |
Merge branch 'main' into better-compatiblity-for-at-time-notation
Conflicts:
src/revparse.c
Diffstat (limited to 'cmake/SelectZlib.cmake')
| -rw-r--r-- | cmake/SelectZlib.cmake | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/cmake/SelectZlib.cmake b/cmake/SelectZlib.cmake new file mode 100644 index 000000000..e377d43b6 --- /dev/null +++ b/cmake/SelectZlib.cmake @@ -0,0 +1,34 @@ +# Optional external dependency: zlib +include(SanitizeBool) + +SanitizeBool(USE_BUNDLED_ZLIB) +if(USE_BUNDLED_ZLIB STREQUAL ON) + set(USE_BUNDLED_ZLIB "Bundled") +endif() + +if(USE_BUNDLED_ZLIB STREQUAL "OFF") + find_package(ZLIB) + if(ZLIB_FOUND) + list(APPEND LIBGIT2_SYSTEM_INCLUDES ${ZLIB_INCLUDE_DIRS}) + list(APPEND LIBGIT2_SYSTEM_LIBS ${ZLIB_LIBRARIES}) + if(APPLE OR CMAKE_SYSTEM_NAME MATCHES "FreeBSD") + list(APPEND LIBGIT2_PC_LIBS "-lz") + else() + list(APPEND LIBGIT2_PC_REQUIRES "zlib") + endif() + add_feature_info(zlib ON "using system zlib") + else() + message(STATUS "zlib was not found; using bundled 3rd-party sources." ) + endif() +endif() +if(USE_BUNDLED_ZLIB STREQUAL "Chromium") + add_subdirectory("${libgit2_SOURCE_DIR}/deps/chromium-zlib" "${libgit2_BINARY_DIR}/deps/chromium-zlib") + list(APPEND LIBGIT2_DEPENDENCY_INCLUDES "${libgit2_SOURCE_DIR}/deps/chromium-zlib") + list(APPEND LIBGIT2_DEPENDENCY_OBJECTS $<TARGET_OBJECTS:chromium_zlib>) + add_feature_info(zlib ON "using (Chromium) bundled zlib") +elseif(USE_BUNDLED_ZLIB OR NOT ZLIB_FOUND) + add_subdirectory("${libgit2_SOURCE_DIR}/deps/zlib" "${libgit2_BINARY_DIR}/deps/zlib") + list(APPEND LIBGIT2_DEPENDENCY_INCLUDES "${libgit2_SOURCE_DIR}/deps/zlib") + list(APPEND LIBGIT2_DEPENDENCY_OBJECTS $<TARGET_OBJECTS:zlib>) + add_feature_info(zlib ON "using bundled zlib") +endif() |
