From 8a9ef297bedbe825963e05d098d0d1a152c6445f Mon Sep 17 00:00:00 2001 From: Chris Lalancette Date: Mon, 19 Aug 2024 20:41:00 +0000 Subject: [PATCH] Switch opennav_docking_core to modern CMake idioms. Signed-off-by: Chris Lalancette --- .../opennav_docking_core/CMakeLists.txt | 38 +++++++++++++------ .../opennav_docking_core/charging_dock.hpp | 3 +- nav2_docking/opennav_docking_core/package.xml | 8 ++-- 3 files changed, 31 insertions(+), 18 deletions(-) diff --git a/nav2_docking/opennav_docking_core/CMakeLists.txt b/nav2_docking/opennav_docking_core/CMakeLists.txt index 639319bc5e..3d62476eff 100644 --- a/nav2_docking/opennav_docking_core/CMakeLists.txt +++ b/nav2_docking/opennav_docking_core/CMakeLists.txt @@ -2,23 +2,34 @@ cmake_minimum_required(VERSION 3.5) project(opennav_docking_core) find_package(ament_cmake REQUIRED) +find_package(geometry_msgs REQUIRED) find_package(nav2_common REQUIRED) -find_package(rclcpp REQUIRED) find_package(rclcpp_lifecycle REQUIRED) -find_package(nav2_util REQUIRED) -find_package(nav2_msgs REQUIRED) +find_package(tf2_ros REQUIRED) nav2_package() -set(dependencies - rclcpp - rclcpp_lifecycle - nav2_msgs - nav2_util +add_library(opennav_docking_core INTERFACE) +target_include_directories(opennav_docking_core + INTERFACE + "$" + "$" +) +target_link_libraries(opennav_docking_core INTERFACE + ${geometry_msgs_TARGETS} + rclcpp_lifecycle::rclcpp_lifecycle + tf2_ros::tf2_ros +) + +install(TARGETS opennav_docking_core + EXPORT opennav_docking_core + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin ) install(DIRECTORY include/ - DESTINATION include/ + DESTINATION include/${PROJECT_NAME} ) if(BUILD_TESTING) @@ -28,7 +39,12 @@ if(BUILD_TESTING) ament_lint_auto_find_test_dependencies() endif() -ament_export_include_directories(include) -ament_export_dependencies(${dependencies}) +ament_export_include_directories(include/${PROJECT_NAME}) +ament_export_dependencies( + geometry_msgs + rclcpp_lifecycle + tf2_ros +) +ament_export_targets(opennav_docking_core) ament_package() diff --git a/nav2_docking/opennav_docking_core/include/opennav_docking_core/charging_dock.hpp b/nav2_docking/opennav_docking_core/include/opennav_docking_core/charging_dock.hpp index b58f9408fb..d4566e5836 100644 --- a/nav2_docking/opennav_docking_core/include/opennav_docking_core/charging_dock.hpp +++ b/nav2_docking/opennav_docking_core/include/opennav_docking_core/charging_dock.hpp @@ -18,9 +18,8 @@ #include #include -#include "rclcpp/rclcpp.hpp" +#include "rclcpp_lifecycle/lifecycle_node.hpp" #include "geometry_msgs/msg/pose_stamped.hpp" -#include "nav2_util/lifecycle_node.hpp" #include "tf2_ros/buffer.h" diff --git a/nav2_docking/opennav_docking_core/package.xml b/nav2_docking/opennav_docking_core/package.xml index bcd03d786b..2df639d516 100644 --- a/nav2_docking/opennav_docking_core/package.xml +++ b/nav2_docking/opennav_docking_core/package.xml @@ -8,16 +8,14 @@ Apache-2.0 ament_cmake + nav2_common - rclcpp + geometry_msgs rclcpp_lifecycle - nav2_util - nav2_msgs + tf2_ros ament_lint_common ament_lint_auto - ament_cmake_gtest - ament_cmake_pytest ament_cmake