From 9fcd0b6d6146938d2372527ff6ebc457a01db0fb Mon Sep 17 00:00:00 2001 From: Antti Andreimann Date: Mon, 10 Aug 2026 21:48:51 +0300 Subject: [PATCH] Use imported targets in grid_map_ros Replace ament_target_dependencies with explicit imported-target linking for the grid_map_ros library. The Lyrical ament toolchain no longer accepts the legacy SYSTEM dependency expansion used here. Linking the exported ROS interface targets directly preserves transitive include paths and libraries, while retaining grid_map_cv's legacy variables until that package exports an imported target. This change allows grid_map_ros 2.4.0 to build on ROS 2 Lyrical and removes the need for downstream CMake patches. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- grid_map_ros/CMakeLists.txt | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/grid_map_ros/CMakeLists.txt b/grid_map_ros/CMakeLists.txt index 2a75ce805..dbddac6fa 100644 --- a/grid_map_ros/CMakeLists.txt +++ b/grid_map_ros/CMakeLists.txt @@ -56,8 +56,25 @@ add_library(${PROJECT_NAME} SHARED src/PolygonRosConverter.cpp ) -ament_target_dependencies(${PROJECT_NAME} SYSTEM - ${dependencies} +target_link_libraries(${PROJECT_NAME} PUBLIC + cv_bridge::cv_bridge + grid_map_core::grid_map_core + rclcpp::rclcpp + rcutils::rcutils + rosbag2_cpp::rosbag2_cpp + tf2::tf2 + ${geometry_msgs_TARGETS} + ${grid_map_msgs_TARGETS} + ${nav2_msgs_TARGETS} + ${nav_msgs_TARGETS} + ${sensor_msgs_TARGETS} + ${std_msgs_TARGETS} + ${visualization_msgs_TARGETS} + ${grid_map_cv_LIBRARIES} +) + +target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC + ${grid_map_cv_INCLUDE_DIRS} ) #############