Paul Fultz II via cmake-developers
2018-06-12 16:11:40 UTC
Hi All,
So from a previous threads, we were discussing pkgconfig and cmake interoperability. One issue with using pkgconfig currently, is that the results are completely flat. This is due to using the CLI to retrieve pkgconfig, which gives the user all the flags from every transitive package. This is great from a user perspective, but from cmake perspective not so because may already being using one of the transitive dependencies.
So instead of using the CLI, there is a library implementation of pkgconfig called pkgconf:
https://github.com/pkgconf/pkgconf <https://github.com/pkgconf/pkgconf>
http://pkgconf.readthedocs.io/en/latest/ <http://pkgconf.readthedocs.io/en/latest/>
CMake could use pkgconf internally, and then use functions like `pkgconf_pkg_traverse` to iterate over the transitive dependencies. We could use variable in the .pc files like `cmake_package` to know which cmake package the dependency belongs to or perhaps `cmake_target` to set the name of the cmake imported target.
Daniel Pfeiffer proposed supporting pkgconfig by extending `find_package`, like this:
find_package(zlib CONF)
And this would look up zlib using pkgconfig. The advantage of this, is that the transitive dependencies can be specified in the same manner as `find_dependency(zlib CONF)`.
Paul
So from a previous threads, we were discussing pkgconfig and cmake interoperability. One issue with using pkgconfig currently, is that the results are completely flat. This is due to using the CLI to retrieve pkgconfig, which gives the user all the flags from every transitive package. This is great from a user perspective, but from cmake perspective not so because may already being using one of the transitive dependencies.
So instead of using the CLI, there is a library implementation of pkgconfig called pkgconf:
https://github.com/pkgconf/pkgconf <https://github.com/pkgconf/pkgconf>
http://pkgconf.readthedocs.io/en/latest/ <http://pkgconf.readthedocs.io/en/latest/>
CMake could use pkgconf internally, and then use functions like `pkgconf_pkg_traverse` to iterate over the transitive dependencies. We could use variable in the .pc files like `cmake_package` to know which cmake package the dependency belongs to or perhaps `cmake_target` to set the name of the cmake imported target.
Daniel Pfeiffer proposed supporting pkgconfig by extending `find_package`, like this:
find_package(zlib CONF)
And this would look up zlib using pkgconfig. The advantage of this, is that the transitive dependencies can be specified in the same manner as `find_dependency(zlib CONF)`.
Paul