zlib
zlib copied to clipboard
cmake config files
A lot of modern libraries now ship their own cmake config files, this reduces finding the package to pretty much just:
set(foo_DIR "path/to/foo/lib/cmake/foo")
find_package(foo
CONFIG
REQUIRED
)
Has this ever been considered for zlib? Happy to raise a PR if so.
There is a CMakeLists.txt file in zlib. What are you proposing?
The CMakeLists.txt included with zlib is for building zlib. I'm hoping @imrichardcole is suggesting a CMake module file that is distributed with the (pre-)built zlib library that makes it easier for downstream builds to locate the zlib header and lib files. Downstream builds would use CMake's find_package function to locate zlib by name only and avoid having to hardcode paths and use fixed locations. We create our own zlib CMake module file when we build zlib in our CI system, so I for one would welcome such a contribution from imricharcole.
Yes, exactly as @Mr-Clam says. This is for the scenario where you want to use a pre-built zlib, rather than include the CMakeLists.txt and build as though it's part of your own source tree. It removes a need for custom FindZlib.cmake files (which was what alerted me to the issue in the first place)
I pretty much have a PR ready to go, it might be easier to understand when you see it.
@imrichardcole there's an open PR that addresses this: https://github.com/madler/zlib/pull/1004 👍
See https://github.com/madler/zlib/pull/1027 .