[bit7z] Update to 4.1.0 (#52491)

This commit is contained in:
Riccardo 2026-06-23 06:20:14 +02:00 committed by GitHub
parent 09633c52c6
commit a429e00e5e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 123 additions and 104 deletions

View File

@ -1,13 +0,0 @@
diff --git a/cmake/CompilerOptions.cmake b/cmake/CompilerOptions.cmake
index 1cdb84f..fd9346f 100644
--- a/cmake/CompilerOptions.cmake
+++ b/cmake/CompilerOptions.cmake
@@ -70,7 +70,7 @@ if( MSVC )
endforeach()
endif()
else()
- target_compile_options( ${LIB_TARGET} PRIVATE -Wall -Wextra -Werror -Wconversion -Wsign-conversion )
+ target_compile_options( ${LIB_TARGET} PRIVATE -Wall -Wextra -Wconversion -Wsign-conversion )
endif()
# Extra warning flags for Clang

View File

@ -0,0 +1,111 @@
diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
index 1e787070..0c2cda4c 100644
--- a/cmake/Dependencies.cmake
+++ b/cmake/Dependencies.cmake
@@ -1,45 +1,45 @@
-# Downloading the CPM.cmake package manager
-set( CPM_DOWNLOAD_VERSION 0.42.3 )
-set( CPM_DOWNLOAD_HASH "a609e875fd532b067174250f6abbc3dac22fe2d64869783fb1e80bda1625c844" )
-if( CPM_SOURCE_CACHE )
- set( CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake" )
-elseif( DEFINED ENV{CPM_SOURCE_CACHE} )
- set( CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake" )
-else()
- set( CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake" )
-endif()
-get_filename_component( CPM_DOWNLOAD_LOCATION ${CPM_DOWNLOAD_LOCATION} ABSOLUTE )
-set( CPM_USE_NAMED_CACHE_DIRECTORIES ON )
-if( NOT ( EXISTS ${CPM_DOWNLOAD_LOCATION} ) )
- message( STATUS "Downloading CPM.cmake to ${CPM_DOWNLOAD_LOCATION}" )
- file( DOWNLOAD
- https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake
- ${CPM_DOWNLOAD_LOCATION}
- SHOW_PROGRESS
- EXPECTED_HASH SHA256=${CPM_DOWNLOAD_HASH}
- )
-endif()
-include( ${CPM_DOWNLOAD_LOCATION} )
-
-# When enabled, dependencies are resolved with find_package() first (e.g., as provided by a package
-# manager such as vcpkg) and only downloaded via CPM if not found. Disabled by default so that a
-# plain checkout builds out-of-the-box by fetching its pinned dependencies.
-option( BIT7Z_USE_SYSTEM_DEPENDENCIES "Resolve dependencies via find_package when available" OFF )
+# When enabled, every dependency is resolved exclusively via find_package() (e.g., as provided by a
+# package manager such as vcpkg): CPM is not bootstrapped and nothing is downloaded during configure.
+# Disabled by default so that a plain checkout builds out-of-the-box by fetching its pinned dependencies.
+option( BIT7Z_USE_SYSTEM_DEPENDENCIES "Resolve all dependencies via find_package (no CPM, no downloads)" OFF )
message( STATUS "Use system dependencies: ${BIT7Z_USE_SYSTEM_DEPENDENCIES}" )
-if( BIT7Z_USE_SYSTEM_DEPENDENCIES )
- set( CPM_USE_LOCAL_PACKAGES ON )
+
+# Bootstrap the CPM.cmake package manager only when a dependency may actually be downloaded. With
+# system dependencies enabled, every dependency is resolved via find_package, so we skip the in-build
+# download entirely (e.g. package managers such as vcpkg forbid network access during configure/build).
+if( NOT BIT7Z_USE_SYSTEM_DEPENDENCIES )
+ # Downloading the CPM.cmake package manager
+ set( CPM_DOWNLOAD_VERSION 0.42.3 )
+ set( CPM_DOWNLOAD_HASH "a609e875fd532b067174250f6abbc3dac22fe2d64869783fb1e80bda1625c844" )
+ if( CPM_SOURCE_CACHE )
+ set( CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake" )
+ elseif( DEFINED ENV{CPM_SOURCE_CACHE} )
+ set( CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake" )
+ else()
+ set( CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake" )
+ endif()
+ get_filename_component( CPM_DOWNLOAD_LOCATION ${CPM_DOWNLOAD_LOCATION} ABSOLUTE )
+ set( CPM_USE_NAMED_CACHE_DIRECTORIES ON )
+ if( NOT ( EXISTS ${CPM_DOWNLOAD_LOCATION} ) )
+ message( STATUS "Downloading CPM.cmake to ${CPM_DOWNLOAD_LOCATION}" )
+ file( DOWNLOAD
+ https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake
+ ${CPM_DOWNLOAD_LOCATION}
+ SHOW_PROGRESS
+ EXPECTED_HASH SHA256=${CPM_DOWNLOAD_HASH}
+ )
+ endif()
+ include( ${CPM_DOWNLOAD_LOCATION} )
endif()
# No custom path to 7-Zip's source code was specified by the user, so we resolve it ourselves.
if( BIT7Z_CUSTOM_7ZIP_PATH STREQUAL "" )
if( BIT7Z_USE_SYSTEM_DEPENDENCIES )
- # When using system dependencies, look for a 7-Zip package via find_package first. Unlike the
- # other dependencies, 7-Zip is searched for *without* a version: bit7z compiles against a specific
- # pinned 7-Zip source for the download path, but a system 7-Zip package (e.g., vcpkg's) may expose
- # a different version and may not even ship a config version file, in which case a versioned
- # find_package would be rejected. We therefore accept whatever 7-Zip the integrator provides.
- # (This is why 7-Zip cannot ride the generic CPM_USE_LOCAL_PACKAGES path, which would forward the
- # CPMAddPackage VERSION to find_package.)
+ # When using system dependencies, resolve 7-Zip via find_package. It is searched for *without*
+ # a version: bit7z compiles against a specific pinned 7-Zip source for the download path, but a
+ # system 7-Zip package (e.g., vcpkg's) may expose a different version and may not even ship a
+ # config version file, in which case a versioned find_package would be rejected. We therefore
+ # accept whatever 7-Zip the integrator provides.
find_package( 7zip CONFIG REQUIRED )
elseif ( BIT7Z_BUILD_FOR_P7ZIP )
# p7zip source code (calling the package as 7-zip just for simplify the code).
@@ -79,13 +79,17 @@ endif()
# ghc::filesystem library
# Note: the public API tests app compiles using the C++11 standard, so it always needs ghc::filesystem.
if( NOT USE_STANDARD_FILESYSTEM OR BIT7Z_BUILD_TESTS )
- CPMAddPackage(
- NAME ghc_filesystem
- GITHUB_REPOSITORY rikyoz/filesystem
- GIT_TAG b99c2aebd5ddd6fb2f190731ba80b949fc3842b5
- GIT_PROGRESS ON
- DOWNLOAD_ONLY YES
- )
+ if( BIT7Z_USE_SYSTEM_DEPENDENCIES )
+ find_package( ghc_filesystem CONFIG REQUIRED )
+ else()
+ CPMAddPackage(
+ NAME ghc_filesystem
+ GITHUB_REPOSITORY rikyoz/filesystem
+ GIT_TAG b99c2aebd5ddd6fb2f190731ba80b949fc3842b5
+ GIT_PROGRESS ON
+ DOWNLOAD_ONLY YES
+ )
+ endif()
# Normalize to a plain "ghc_filesystem" target that the rest of the build and the tests link,
# regardless of whether it came from the downloaded sources or from find_package.

View File

@ -1,28 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f8ff6f0..855b78d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -194,15 +194,22 @@ include( cmake/BuildOptions.cmake )
include( cmake/CompilerOptions.cmake )
# dependencies
-include( cmake/Dependencies.cmake )
+# include( cmake/Dependencies.cmake )
+find_package(7zip CONFIG REQUIRED)
+add_library(7-zip ALIAS 7zip::7zip)
# 7-zip source code
target_link_libraries( ${LIB_TARGET} PRIVATE 7-zip )
# filesystem library (needed if std::filesystem is not available)
+if(0)
if( ghc_filesystem_ADDED )
target_link_libraries( ${LIB_TARGET} PRIVATE ghc_filesystem )
endif()
+else()
+ find_package(ghc_filesystem CONFIG REQUIRED)
+ target_link_libraries(${LIB_TARGET} PRIVATE ghcFilesystem::ghc_filesystem )
+endif()
# public includes
target_include_directories( ${LIB_TARGET} PUBLIC "$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>"

View File

@ -1,43 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2eb8634..f8ff6f0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -179,7 +179,7 @@ message( STATUS "Language Standard for bit7z: C++${CMAKE_CXX_STANDARD}" )
set( LIB_TARGET bit7z${ARCH_POSTFIX} )
add_library( ${LIB_TARGET} STATIC )
target_sources( ${LIB_TARGET}
- PUBLIC ${PUBLIC_HEADERS}
+ # PUBLIC ${PUBLIC_HEADERS}
PRIVATE ${HEADERS} ${SOURCES} )
# additional target without the architecture suffix in the name
@@ -246,3 +246,29 @@ endif()
if( BIT7Z_BUILD_DOCS )
add_subdirectory( docs )
endif()
+
+set_target_properties(${LIB_TARGET} PROPERTIES PUBLIC_HEADER "${PUBLIC_HEADERS}")
+
+include(CMakePackageConfigHelpers)
+configure_package_config_file(
+ "${CMAKE_CURRENT_SOURCE_DIR}/unofficial-bit7z-config.cmake.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/unofficial-bit7z-config.cmake"
+ INSTALL_DESTINATION "share/unofficial-bit7z"
+)
+install(
+ FILES "${CMAKE_CURRENT_BINARY_DIR}/unofficial-bit7z-config.cmake"
+ DESTINATION "share/unofficial-bit7z"
+)
+
+include(GNUInstallDirs)
+install(
+ TARGETS ${LIB_TARGET}
+ EXPORT unofficial-bit7z-targets
+ COMPONENT bit7z
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/bit7z COMPONENT bit7z_development)
+
+install(EXPORT unofficial-bit7z-targets FILE unofficial-bit7z-targets.cmake NAMESPACE unofficial::bit7z:: DESTINATION share/unofficial-bit7z)
+

View File

@ -4,16 +4,11 @@ vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO rikyoz/bit7z
REF "v${VERSION}"
SHA512 57727b2f4906802e1b5b07b8e8741da8e162d4491fa1ba59b9e7ec61f8b405654872c46184e7c83660cb9dbb61bbebc88787715fbcac1251de799ad157738358
SHA512 d240997e3b1f6eb8d0b19c89bf3b12044cbb10ba495b4ba535efc1cd04390157031a303025819b6fd9a6a51bdca7b59ad50df45055cbde9130ffd4c8279a0863
HEAD_REF master
PATCHES
fix_install.patch
fix_dependency.patch
fix_compile_options.patch
PATCHES fix_dependencies.patch
)
file(COPY "${CMAKE_CURRENT_LIST_DIR}/unofficial-bit7z-config.cmake.in" DESTINATION "${SOURCE_PATH}")
vcpkg_check_features(
OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
@ -23,6 +18,7 @@ vcpkg_check_features(
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DBIT7Z_USE_SYSTEM_DEPENDENCIES=ON
-DBIT7Z_AUTO_FORMAT=ON
-DBIT7Z_AUTO_PREFIX_LONG_PATHS=ON
-DBIT7Z_DISABLE_ZIP_ASCII_PWD_CHECK=OFF
@ -33,13 +29,14 @@ vcpkg_cmake_configure(
-DBIT7Z_USE_SYSTEM_CODEPAGE=OFF
-DBIT7Z_BUILD_TESTS=OFF
-DBIT7Z_BUILD_DOCS=OFF
-DBIT7Z_WARNINGS_AS_ERRORS=OFF
${FEATURE_OPTIONS}
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-bit7z CONFIG_PATH share/unofficial-bit7z)
vcpkg_cmake_config_fixup(PACKAGE_NAME bit7z CONFIG_PATH lib/cmake/bit7z)
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")

View File

@ -1,10 +0,0 @@
@PACKAGE_INIT@
include(CMakeFindDependencyMacro)
find_dependency(7zip CONFIG)
find_dependency(ghc_filesystem CONFIG)
include("${CMAKE_CURRENT_LIST_DIR}/unofficial-bit7z-targets.cmake")
check_required_components(bit7z)

View File

@ -1,6 +1,6 @@
{
"name": "bit7z",
"version": "4.0.12",
"version": "4.1.0",
"description": "A C++ static library offering a clean and simple interface to the 7-zip shared libraries.",
"homepage": "https://github.com/rikyoz/bit7z",
"license": "MPL-2.0",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "9213e0a8efee92fd902fd7d486e88b7f105c1e4c",
"version": "4.1.0",
"port-version": 0
},
{
"git-tree": "9d58d639b9def3a5199444a1b3ad1c46af61901a",
"version": "4.0.12",

View File

@ -741,7 +741,7 @@
"port-version": 3
},
"bit7z": {
"baseline": "4.0.12",
"baseline": "4.1.0",
"port-version": 0
},
"bitmagic": {