Add ICU as an alternative backend to libiconv using ucnv_convert.
ICU is detected via CMake's FindICU module on non-Windows platforms.
Add CI build configuration for ICU in GitHub Actions.
Both packages export separate static and shared imported targets, but
the find_package paths picked one variant unconditionally — zstd
preferred libzstd_static and zlib-ng always linked the shared zlib.
Building minizip-ng with BUILD_SHARED_LIBS=ON against a system zstd
that ships both variants therefore produced a libminizip.so with zstd
statically baked in (#983).
A shared minizip encapsulates its PRIVATE backend deps (bzip2, lzma, zstd,
iconv, ...) inside the .so/.dylib, and minizip-targets.cmake doesn't
reference them. Emitting find_dependency() for those backends in the
generated package config forces consumers of shared minizip to install
every backend just to call find_package(minizip), even when nothing
needs them.
Split MINIZIP_DEP_PKG into a PUBLIC list (always required, e.g. ZLIB
under MZ_COMPAT) and a private list emitted only when minizip is built
static. The static archive still requires all of them transitively.
Fixes#898.
Hard-coding "-lssl -lcrypto" in Libs.private breaks for LibreSSL (different
library names), MSVC import libraries, and custom build suffixes. Reference
openssl in Requires.private instead so the consumer's pkg-config delegates
to openssl.pc and resolves the correct library names locally.
Caught in PR review on #983.
compat/zip.h and compat/unzip.h reference zlib types and macros (ZEXPORT,
Z_DEFLATED, ...), so any consumer including those headers needs zlib's
INTERFACE_INCLUDE_DIRECTORIES on its include path. Linking via the imported
target keeps the install portable: find_dependency(ZLIB) on the consumer
recreates the target with the consumer's local paths, not the build host's.
Other backends are pure implementation details and stay PRIVATE.
Refs #914.
The list drives find_dependency() calls in the generated minizip-config.cmake,
so registering a package whose CMake config doesn't exist on the consumer
machine (PPMD, fetched BZip2/LibLZMA/zstd, etc.) makes find_package(minizip)
fail at configure time. Only register a package when it was located via
find_package, not when built from a fetched source tree (those targets are
already carried forward through install(EXPORT)).
Add Threads to MINIZIP_DEP_PKG when liblzma is fetched, since upstream xz's
exported target lists Threads::Threads in its INTERFACE_LINK_LIBRARIES and
the consumer's config has to recreate that imported target.
Refs #914.
Backend libraries (zlib, bzip2, lzma, zstd, openssl, iconv, frameworks)
are implementation details that don't appear in mz.h's public API, so
their linkage is PRIVATE rather than PUBLIC. For static minizip CMake
still propagates them transitively via INTERFACE_LINK_LIBRARIES_PRIVATE
when needed; for shared minizip they stay encapsulated and don't pollute
consumer link lines.
The target_link_directories call is no longer needed because every
imported target carries its own library directory; MINIZIP_LBD is
removed along with it.
Refs #914.
find_library returns SDK-absolute paths like
/Applications/Xcode.app/.../MacOSX.sdk/System/Library/Frameworks/CoreFoundation.framework
which get baked into INTERFACE_LINK_LIBRARIES on install and break
downstream consumers whose SDK lives at a different path. Pass the
frameworks as plain "-framework Foo" linker flags so each consumer's
own toolchain resolves them.
Refs #914.
Replace raw ${FOO_LIBRARIES} / ${FOO_LIBRARY_DIRS} / ${FOO_INCLUDE_DIRS}
appends with imported target references so installed targets files don't
bake build-machine paths into INTERFACE_LINK_LIBRARIES. Affects ZLIB-NG,
ZLIB, BZip2, LibLZMA, ZSTD, OpenSSL, Iconv, and libbsd. Drops the
pkg-config-first paths for LZMA/ZSTD/OpenSSL since find_package now
provides portable imported targets across CMake 3.14+.
Refs #914.
One may prefer to use OpenSSL instead of BCrypt even on Windows,
for example, for consistency in cross-platform projects,
performance reasons etc.
The current CMakeLists.txt fully support such configurations,
except that commit abc80d1049 ("Clean up CMake options and add
feature_info for MZ_BCRYPT") make the MZ_OPENSSL option not
available on Windows.
Restore the pre-commit behaviour. The default configuration will
behave the same way as before the change (use BCrypt by default
and don't test for OpenSSL on Windows).
Tested on Windows 11 w/clang-cl.
Signed-off-by: Alexander Lobakin <alobakin@mailbox.org>
Check if the symlink and readlink functions exist, and define NO_SYMLINK and NO_READLINK based on the results.
VitaSDK will be recognized as Linux, but it does not support symbolic links.
Instead of assuming zlib-ng preference over zlib as a dependency, let
the user decide.
New cmake variable MZ_ZLIB_FLAVOR can be set to auto | zlib-ng | zlib
defaults to auto.
There is a small race where a file can be replaced with a link between the
call to mz_os_is_symlink and the call to mz_stream_os_open. Add
MZ_OPEN_MODE_NOFOLLOW to make sure that (on POSIX) a link cannot be
followed.