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 comes with FindZLIB and zlib ZLIBConfig and the targets they import are different. #366

Open
johnb003 opened this issue Jun 25, 2018 · 4 comments

Comments

@johnb003
Copy link

FindZLIB will import targets ZLIB::ZLIB. (https://github.com/Kitware/CMake/blob/master/Modules/FindZLIB.cmake)

However if zlib is built, it exports a ZLIBConfig that can import ZLIB::zlib (the case makes them different).

FindXXX is called "module mode", and XXXConfig is called "config mode". Module mode takes precedence over config mode, so while ZLIB appears to be exporting ZLIB::zlib, it won't be imported with find_package (unless the user specifies "CONFIG" to find package). However, this is problematic as most third party libraries assume it's on the system and will not do that, thus if you build it yourself you have to hand edit everything else that's building to link to the correct one.

I'd say this is a problem with cmake taking ownership. I've commented here, and if you're reading this, hop over and add your support.
https://gitlab.kitware.com/cmake/cmake/issues/16805

In the meantime maybe we should keep consistent with the interface cmake is providing?

@ghost
Copy link

ghost commented Nov 18, 2018

Does zlib really create export files for config mode? I am not getting them when building current master branch (tried on Windows and Ubuntu). Also, I can't see anything in zlib's CMakeLists.txt that would indicate that such config would be created (no install(EXPORT ...) etc.) Where do you get your zlib source?

@Mizux
Copy link

Mizux commented Mar 22, 2019

see #337 ....

@Mizux
Copy link

Mizux commented Jan 29, 2020

@johnb003 I would say the problem is madler who lets zlib not maintained and don't let us (the OSS community) having an OSS Community Modern CMake based build...

  1. When you lose interest in a program, your last duty to it is to hand it off to a competent successor.

src: https://en.wikipedia.org/wiki/The_Cathedral_and_the_Bazaar
note: I'm not the competent guy 😉

Otherwise my 2 cents,
Currently I use this patch: https://github.com/google/or-tools/blob/master/patches/ZLIB.patch
(which is based on #337 BTW)

mainly this:
https://github.com/google/or-tools/blob/858fa626959f7e386153af82756384b79f983b5a/patches/ZLIB.patch#L103-L121

@Neustradamus
Copy link

@madler: Can you look?

yalcinerbora pushed a commit to yalcinerbora/zlib that referenced this issue Jun 19, 2023
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

3 participants