Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should I use ament_export_dependencies for PRIVATE dependency? #532

Open
felixf4xu opened this issue Jun 8, 2024 · 1 comment
Open

Should I use ament_export_dependencies for PRIVATE dependency? #532

felixf4xu opened this issue Jun 8, 2024 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@felixf4xu
Copy link

Hi,

I see several examples in ROS2 code that ament_export_dependencies is used for PRIVATE dependencies, like

  1. kdl_parser project
    https://github.com/ros/kdl_parser/blob/jazzy/kdl_parser/CMakeLists.txt#L28
target_link_libraries(${PROJECT_NAME} PRIVATE
  rcutils::rcutils
  urdf::urdf)

and it's exported:
https://github.com/ros/kdl_parser/blob/jazzy/kdl_parser/CMakeLists.txt#L59

ament_export_dependencies(rcutils)
  1. camera_calibration_parsers project

https://github.com/ros-perception/image_common/blob/jazzy/camera_calibration_parsers/CMakeLists.txt#L33

target_link_libraries(${PROJECT_NAME} PRIVATE
  rclcpp::rclcpp
  yaml-cpp::yaml-cpp)

and it's exported:
https://github.com/ros-perception/image_common/blob/jazzy/camera_calibration_parsers/CMakeLists.txt#L88

ament_export_dependencies(rclcpp sensor_msgs yaml_cpp_vendor)

I can list more if I search more in the ros2 source code. I have to say, those usage really confused me. For PRIVATE dependencies, I don't think it's necessary to export them.

Before I raise an issue for those projects, I'd like to make sure the usage of ament_export_dependencies for PRIVATE dependencies, it's not mentioned here https://docs.ros.org/en/jazzy/How-To-Guides/Ament-CMake-Documentation.html

@clalancette
Copy link
Contributor

I can list more if I search more in the ros2 source code. I have to say, those usage really confused me. For PRIVATE dependencies, I don't think it's necessary to export them.

You are correct. For PRIVATE dependencies, they should not be exported. Those are bugs, so if you'd like to open PRs to fix that, I'd be happy to review them.

@clalancette clalancette added the help wanted Extra attention is needed label Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants