Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake config files #1009

Open
imrichardcole opened this issue Sep 11, 2024 · 4 comments
Open

cmake config files #1009

imrichardcole opened this issue Sep 11, 2024 · 4 comments

Comments

@imrichardcole
Copy link

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.

@madler
Copy link
Owner

madler commented Sep 18, 2024

There is a CMakeLists.txt file in zlib. What are you proposing?

@Mr-Clam
Copy link

Mr-Clam commented Sep 18, 2024

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.

@imrichardcole
Copy link
Author

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.

@witte
Copy link

witte commented Sep 29, 2024

@imrichardcole there's an open PR that addresses this: #1004 👍

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

No branches or pull requests

4 participants