conan-io / conan-center-index

Recipes for the ConanCenter repository
https://conan.io/center
MIT License
941 stars 1.69k forks source link

[question] How to replace zlib with zlib-ng #14748

Open Nekto89 opened 1 year ago

Nekto89 commented 1 year ago

I'm curious what is the proper approach for replacing zlib with zlib-ng? zlib-ng can provide compatible API and theoretically be used everywhere instead of zlib. Should all recipes that depend on zlib have option for choosing zlib/zlib-ng?

SpaceIm commented 1 year ago

There is no proper approach currently, the only one would be to create a virtual package, but it's still unclear how such recipe should look like: https://github.com/conan-io/conan/issues/12374

Current (horrible) approach is to add an option in all recipes having such dependency (like we do sometimes for libjpeg & libjpeg-turbo), but it's a terrible user experience because there is not one source of truth to guarantee consistent dependency graph.

Moreover it's not because you expose zlib-ng instead of zlib that build systems will be able to find & inject zlib-ng automagically (zlib-ng recipe doesn't generate FindZLIB.cmake for example, but it could be fixed when zlib_compat option is enabled).

Nekto89 commented 1 year ago

@SpaceIm new version of ITK (5.3.0) will contain zlib-ng instead of zlib. This might bring a lot of conflicts because ITK depends on other libraries that use pure zlib

Nekto89 commented 12 months ago

@SpaceIm Should this be added to zlib-ng recipe in CCI under compatibility option (copied from zlib recipe)? And also probably provides = "zlib"?

self.cpp_info.set_property("cmake_find_mode", "both")
self.cpp_info.set_property("cmake_file_name", "ZLIB")
self.cpp_info.set_property("cmake_target_name", "ZLIB::ZLIB")
self.cpp_info.set_property("pkg_config_name", "zlib")
self.cpp_info.names["cmake_find_package"] = "ZLIB"
self.cpp_info.names["cmake_find_package_multi"] = "ZLIB"
Nekto89 commented 11 months ago

@SpaceIm Should this be added to zlib-ng recipe in CCI under compatibility option (copied from zlib recipe)? And also probably provides = "zlib"?

self.cpp_info.set_property("cmake_find_mode", "both")
self.cpp_info.set_property("cmake_file_name", "ZLIB")
self.cpp_info.set_property("cmake_target_name", "ZLIB::ZLIB")
self.cpp_info.set_property("pkg_config_name", "zlib")
self.cpp_info.names["cmake_find_package"] = "ZLIB"
self.cpp_info.names["cmake_find_package_multi"] = "ZLIB"

Added here: #19476