diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 12:47:08 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 12:47:08 +0000 |
commit | 29b5ab554790bb57337a3b6ab9dcd963cf69d22e (patch) | |
tree | be1456d2bc6c1fb078695fad7bc8f6b212062d3c /cmake/SelectZlib.cmake | |
parent | Initial commit. (diff) | |
download | libgit2-29b5ab554790bb57337a3b6ab9dcd963cf69d22e.tar.xz libgit2-29b5ab554790bb57337a3b6ab9dcd963cf69d22e.zip |
Adding upstream version 1.7.2+ds.upstream/1.7.2+ds
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
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 0000000..fb4361a --- /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("${PROJECT_SOURCE_DIR}/deps/chromium-zlib" "${PROJECT_BINARY_DIR}/deps/chromium-zlib") + list(APPEND LIBGIT2_DEPENDENCY_INCLUDES "${PROJECT_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("${PROJECT_SOURCE_DIR}/deps/zlib" "${PROJECT_BINARY_DIR}/deps/zlib") + list(APPEND LIBGIT2_DEPENDENCY_INCLUDES "${PROJECT_SOURCE_DIR}/deps/zlib") + list(APPEND LIBGIT2_DEPENDENCY_OBJECTS $<TARGET_OBJECTS:zlib>) + add_feature_info(zlib ON "using bundled zlib") +endif() |