ros2 / rcl_logging

Logging implementations for ROS 2.
Apache License 2.0
18 stars 34 forks source link

Issue with the generated CMake config files #121

Open gergondet-woven opened 1 week ago

gergondet-woven commented 1 week ago

Hello,

With https://github.com/ros2/rcl_logging/pull/102, the dependency of rcl_logging_spdlog upon rcl_logging_interface was removed for downstream users. The reasoning behind the PR makes sense but the library still has one public dependency on rcl_logging_interface, defined here.

This means that when one calls find_package(rcl_logging_spdlog REQUIRED) in an isolated setting*, the rcl_logging_spdlog library links to an unknown library.

I think this can be simply addressed by limiting the link to the build interface, i.e.:

target_link_libraries(${PROJECT_NAME} PUBLIC
  $<BUILD_INTERFACE:rcl_logging_interface::rcl_logging_interface>)

or by making this link private and linking the test with rcl_logging_interface explicitly.

*note: I realize this not a very common scenario, we came across this issue because we use these Bazel rules which uses CMake in this way to scrape underlying colcon workspace.

Thanks in advance for taking this into consideration and have a good day!

fujitatomoya commented 1 week ago

@gergondet-woven https://github.com/ros2/rcl_logging/pull/122 is created, it would be appreciated if you give me a feedback.