conan-io / conan-center-index

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

[question] pkgconf + CMake #19780

Open Nekto89 opened 1 year ago

Nekto89 commented 1 year ago

What is your question?

Hi.

Will it be useful to remove pkgconf build requirement for libraries that use CMake through additional patch? If I understand correctly, having normal find_package instead of pkg_check_modules should work perfectly fine for requirements that are provided by conan.

Or is it better to have this mix of pkg_check_modules with find_package?

SpaceIm commented 1 year ago

There is not rule. If upstream CMakeLists relies on pkgconf for the discovery of few libraries, then I don't see any reason to patch this file forever (maintenance burden) unless there is a good reason or if it leads to an improvement of build robustness.

Nekto89 commented 1 year ago

There is not rule. If upstream CMakeLists relies on pkgconf for the discovery of few libraries, then I don't see any reason to patch this file forever (maintenance burden) unless there is a good reason or if it leads to an improvement of build robustness.

pkgconf is additional build requirement. And pkgconf requires meson. And meson requires ninja. I just looked at minizip-ng recipe and CMakeLists.txt and it looks like it should be quite easy to get rid of it. I don't fully understand what pkgconf brings to the table in case of using conan.

SpaceIm commented 1 year ago

I don't fully understand what pkgconf brings to the table in case of using conan.

It depends. But if upstream CMakeLists relies on pkgconf and you want to get rid of pkgconf in build requirements, you have to patch this file forever, it can be complex, and contributors tend to make mistake when they package new versions (patch may need to be updated for this new version).

For minizip-ng, patch may be quite simple, but a naive contributor may forget to propagate this patch to a new version, and it could work actually in some circumstances, but it may lead to side effects when pkgconfig is installed at system level (because minizip-ng first checks pkgconf before CMake config files, so it may find pkg-config, then find a .pc file of zstd, lzma or openssl at system level because we would have removed PkgConfigDeps generator, and therefore inject a system installed dependency instead of conan one).

Honestly I'm not against removing pkgconf discovery when upstream build files are fragile anyway, but for minizip-ng it works fine. What's the problem with pkgconf? It requires meson only if you have to build pkfconf from source.