libzip icon indicating copy to clipboard operation
libzip copied to clipboard

Cmake Zlib FetchContent Surport

Open imcloud opened this issue 7 months ago • 1 comments

Description

I want libzip to support Zlib via FetchContent, not just through find_package(ZLIB). This would allow more flexible and modern CMake integration, with the option to download Zlib or use a local source tree as needed.

Solution

Make libzip compatible with Zlib provided via FetchContent. Ideally, I should be able to FetchContent_Declare both Zlib and libzip, and have everything work out of the box without extra setup.

Describe alternatives you've considered

Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR) (Required is
  at least version "1.1.2")

Manual workarounds to pass paths, which are fragile and not ideal.

Additional context

On Windows 10, getting find_package to work often takes extra effort, so I prefer using FetchContent for all dependencies. That way, Zlib can be fetched once and shared across libraries like Protobuf.

imcloud avatar Jun 07 '25 23:06 imcloud

I'm not against it, but I have no experience with this. Could you please provide a tested patch?

0-wiz-0 avatar Jun 17 '25 20:06 0-wiz-0