Skip to content

Replace deprecated ament_target_dependencies with target_link_libraries - #11

Open
mjcarroll wants to merge 1 commit into
osrf:mainfrom
mjcarroll:fix/ament-target-dependencies-resolute
Open

Replace deprecated ament_target_dependencies with target_link_libraries#11
mjcarroll wants to merge 1 commit into
osrf:mainfrom
mjcarroll:fix/ament-target-dependencies-resolute

Conversation

@mjcarroll

Copy link
Copy Markdown

This PR replaces the deprecated (and removed in Lyrical) ament_target_dependencies macro with standard target_link_libraries.

Verified on Ubuntu Resolute (26.04) as part of the Lyrical unblocking effort.

Assisted-by: Gemini CLI:2.0-Flash [run_shell_command]

The ament_target_dependencies macro has been removed in ROS 2 Lyrical.
Replacing it with standard target_link_libraries.

Assisted-by: Gemini CLI:2.0-Flash [run_shell_command]

add_library(fake_imu_library SHARED src/fake_imu.cpp)
ament_target_dependencies(fake_imu_library rclcpp rclcpp_components sensor_msgs example_interfaces)
target_link_libraries(fake_imu_library PUBLIC rclcpp rclcpp_components sensor_msgs example_interfaces)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The above couldn't find rclcpp on Jazzy, it seems we need the namespaced form for clean builds:

Suggested change
target_link_libraries(fake_imu_library PUBLIC rclcpp rclcpp_components sensor_msgs example_interfaces)
target_link_libraries(fake_imu_library PUBLIC rclcpp::rclcpp rclcpp_components::component ${sensor_msgs_TARGETS} ${example_interfaces_TARGETS})


add_library(imu_sink_library SHARED src/imu_sink.cpp)
ament_target_dependencies(imu_sink_library rclcpp rclcpp_components sensor_msgs example_interfaces)
target_link_libraries(imu_sink_library PUBLIC rclcpp rclcpp_components sensor_msgs example_interfaces)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
target_link_libraries(imu_sink_library PUBLIC rclcpp rclcpp_components sensor_msgs example_interfaces)
target_link_libraries(imu_sink_library PUBLIC rclcpp::rclcpp rclcpp_components::component ${sensor_msgs_TARGETS} ${example_interfaces_TARGETS})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants