From 81944b04d9fdf9e6e15561cfc594bf281952cc83 Mon Sep 17 00:00:00 2001 From: Shane Loretz Date: Sun, 29 Sep 2024 14:31:28 -0700 Subject: [PATCH] more changes Signed-off-by: Shane Loretz --- .../Migrating-CPP-Packages.rst | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/source/How-To-Guides/Migrating-from-ROS1/Migrating-CPP-Packages.rst b/source/How-To-Guides/Migrating-from-ROS1/Migrating-CPP-Packages.rst index d0232d7547..220836a093 100644 --- a/source/How-To-Guides/Migrating-from-ROS1/Migrating-CPP-Packages.rst +++ b/source/How-To-Guides/Migrating-from-ROS1/Migrating-CPP-Packages.rst @@ -844,9 +844,18 @@ Add a call to ``ament_package()`` at the bottom of the ``CMakeLists.txt``. ament_package() +Use ``target_link_libraries`` to make the ``talker`` target depend on the modern CMake targets provided by ``rclcpp`` and ``std_msgs``. + +.. code-block:: cmake + + target_link_libraries(talker PUBLIC + rclcpp::rclcpp + ${std_msgs_TARGETS}) + Delete the call to ``include_directories()``. Replace it with a call to ``target_include_directories()`` for your package's ``include`` directory. -Don't add other package's ``*_INCLUDE_DIRS`` variables, those will be handled by depending on modern CMake targets. +Don't pass variables like ``rclcpp_INCLUDE_DIRS`` into ``target_include_directories()``. +The include directories were already handled by calling ``target_link_libraries()`` with modern CMake targets. .. code-block:: cmake @@ -854,14 +863,6 @@ Don't add other package's ``*_INCLUDE_DIRS`` variables, those will be handled by "$" "$") -Use ``target_link_libraries`` to make the ``talker`` target depend on the modern CMake targets provided by ``rclcpp`` and ``std_msgs``. - -.. code-block:: cmake - - target_link_libraries(talker PUBLIC - rclcpp::rclcpp - ${std_msgs_TARGETS}) - Install the ``talker`` executable into a project specific directory so that it is discoverable by tools like ``ros2 run``. .. code-block:: cmake