gazebosim / gz-cmake

A set of CMake modules that are used by the C++-based Gazebo projects.
https://gazebosim.org/libs/cmake
Apache License 2.0
27 stars 30 forks source link

pkg-config does not include required components from dependencies #450

Open azeey opened 2 months ago

azeey commented 2 months ago

Environment

Description

Steps to reproduce

  1. Add the line
    gz_find_package(gz-utils3 REQUIRED COMPONENTS log)

    Right before gz_configure_build in https://github.com/gazebosim/gz-cmake/blob/3b33067c07460f95af3cbebfff76bdcff4e2d5fe/examples/core_nodep/CMakeLists.txt#L7

  2. Assuming you have gz-utils3-log installed, build project and read the contents of cmake/pkgconfig/gz-core_no_deps.pc in the build directory. You should see
    
    prefix=${pcfiledir}/../../
    libdir=${prefix}/lib
    includedir=${prefix}/include/gz/core_no_deps0

Name: Gazebo core_no_deps Description: A set of core_no_deps classes for robot applications Version: 0.1.0 Requires: gz-cmake4 >= 1.1 gz-utils3 Requires.private: Libs: -L${libdir} -lgz-core_no_deps Libs.private: CFlags: -I${includedir} -std=c++11



In the `Requires` clause, there is `gz-utils3`, but not `gz-utils3-log`.
scpeters commented 2 months ago

I noticed this too. I think the fix needs to be in the following lines of gz-config.cmake.in:

gz_pkg_config_entry is called once with the package name, but we should collect the names of required components and include those as well in a space-separated string (like gz-utils3 gz-utils3-log). This could be done by:

scpeters commented 2 months ago

potential fix in https://github.com/gazebosim/gz-cmake/pull/451

azeey commented 1 week ago

Per our discussion in the PMC meeting, we should remove pkg-config support from gz-cmake since it's not used anywhere in our code base and most users are probably not using it.