Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
4e84ddd5
Commit
4e84ddd5
authored
Nov 10, 2021
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmake: refactor zlib selection
Move zlib selection into its own cmake module.
parent
83fa5480
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
33 deletions
+35
-33
cmake/SelectZlib.cmake
+34
-0
src/CMakeLists.txt
+1
-33
No files found.
cmake/SelectZlib.cmake
0 → 100644
View file @
4e84ddd5
# 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_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_INCLUDES
"
${
libgit2_SOURCE_DIR
}
/deps/chromium-zlib"
)
list
(
APPEND LIBGIT2_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_INCLUDES
"
${
libgit2_SOURCE_DIR
}
/deps/zlib"
)
list
(
APPEND LIBGIT2_OBJECTS $<TARGET_OBJECTS:zlib>
)
add_feature_info
(
zlib ON
"using bundled zlib"
)
endif
()
src/CMakeLists.txt
View file @
4e84ddd5
...
@@ -99,42 +99,10 @@ include(SelectHTTPParser)
...
@@ -99,42 +99,10 @@ include(SelectHTTPParser)
include
(
SelectRegex
)
include
(
SelectRegex
)
include
(
SelectSSH
)
include
(
SelectSSH
)
include
(
SelectWinHTTP
)
include
(
SelectWinHTTP
)
include
(
SelectZlib
)
target_sources
(
git2internal PRIVATE
${
SRC_SHA1
}
)
target_sources
(
git2internal PRIVATE
${
SRC_SHA1
}
)
# Optional external dependency: zlib
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_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_INCLUDES
"
${
libgit2_SOURCE_DIR
}
/deps/chromium-zlib"
)
list
(
APPEND LIBGIT2_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_INCLUDES
"
${
libgit2_SOURCE_DIR
}
/deps/zlib"
)
list
(
APPEND LIBGIT2_OBJECTS $<TARGET_OBJECTS:zlib>
)
add_feature_info
(
zlib ON
"using bundled zlib"
)
endif
()
# Optional external dependency: ntlmclient
# Optional external dependency: ntlmclient
if
(
USE_NTLMCLIENT
)
if
(
USE_NTLMCLIENT
)
set
(
GIT_NTLM 1
)
set
(
GIT_NTLM 1
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment