Skip to content

cmake comes with FindZLIB and zlib ZLIBConfig and the targets they import are different. #366

@johnb003

Description

@johnb003

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions