Skip to content

Allow CMake 3.x with zlib 1.3.2#80

Open
TheNicker wants to merge 2 commits into
agruzdev:masterfrom
TheNicker:cmake3
Open

Allow CMake 3.x with zlib 1.3.2#80
TheNicker wants to merge 2 commits into
agruzdev:masterfrom
TheNicker:cmake3

Conversation

@TheNicker
Copy link
Copy Markdown

@TheNicker TheNicker commented May 14, 2026

Summary

Fixes #77.

This PR contains two separate zlib-related fixes.

First, the project currently requires CMake 4.2 because that version's FindZLIB module recognizes zlib 1.3.2's Windows static library names, zs.lib and zsd.lib. That lookup detail is local to the bundled zlib dependency, so this PR keeps the CMake minimum in the 3.x line and passes the exact zlib library path to downstream dependency builds that call find_package(ZLIB).

Second, clean Ninja builds need the installed zlib static library to be declared as an ExternalProject byproduct. This issue is independent of CMake 4.2's ability to find zlib: even when the correct zlib library path is known, Ninja still needs a build rule that says the zlib install step produces that file before FreeImage links against it.

Changes

  • Change the top-level CMake requirement to 3.28...4.2.
  • Keep zlib 1.3.2 and its zs / zsd Windows static library naming.
  • Reuse the known zlib library path from dependency.zlib.cmake.
  • Pass ZLIB_LIBRARY to PNG, TIFF, HEIF, and JPEG XL dependency builds.
  • Declare the installed zlib static library as an ExternalProject INSTALL_BYPRODUCTS output so Ninja can order clean builds correctly.

Lior Lahav added 2 commits May 14, 2026 18:43
The zlib external project links FreeImage against the installed static library, but Ninja needs that generated file declared on the install step. Record the platform-specific zlib library name and expose it through INSTALL_BYPRODUCTS while still deriving ZLIB_ROOT from the ExternalProject install directory.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Revert the CMake minimum back to 3.x.

1 participant