From 34e323e15c99ec4d19820636d58b75297a05912d Mon Sep 17 00:00:00 2001 From: Shane Loretz Date: Sat, 8 Feb 2025 00:33:02 +0000 Subject: [PATCH 1/2] Use target_link_libraries instead of ament_target_dependencies Signed-off-by: Shane Loretz --- ros2lifecycle_test_fixtures/CMakeLists.txt | 4 ++-- ros2pkg/ros2pkg/resource/ament_cmake/CMakeLists.txt.em | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ros2lifecycle_test_fixtures/CMakeLists.txt b/ros2lifecycle_test_fixtures/CMakeLists.txt index 1c3687838..787aff04e 100644 --- a/ros2lifecycle_test_fixtures/CMakeLists.txt +++ b/ros2lifecycle_test_fixtures/CMakeLists.txt @@ -19,8 +19,8 @@ find_package(rclcpp REQUIRED) add_executable(simple_lifecycle_node src/simple_lifecycle_node.cpp) -ament_target_dependencies(simple_lifecycle_node - "rclcpp_lifecycle") +target_link_libraries(simple_lifecycle_node PRIVATE + rclcpp_lifecycle::rclcpp_lifecycle) install(TARGETS simple_lifecycle_node diff --git a/ros2pkg/ros2pkg/resource/ament_cmake/CMakeLists.txt.em b/ros2pkg/ros2pkg/resource/ament_cmake/CMakeLists.txt.em index d49d6bf2f..6d0138f77 100644 --- a/ros2pkg/ros2pkg/resource/ament_cmake/CMakeLists.txt.em +++ b/ros2pkg/ros2pkg/resource/ament_cmake/CMakeLists.txt.em @@ -28,10 +28,10 @@ target_include_directories(@(cpp_library_name) PUBLIC $ $) @[ if dependencies]@ -ament_target_dependencies( +target_link_libraries( @(cpp_library_name) @[ for dep in dependencies]@ - "@(dep)" + ${@(dep)_TARGETS} @[ end for]@ ) @[ end if]@ @@ -63,10 +63,10 @@ target_link_libraries(@(cpp_node_name) @(cpp_library_name)) @[ else]@ target_compile_features(@(cpp_node_name) PUBLIC c_std_99 cxx_std_17) # Require C99 and C++17 @[ if dependencies]@ -ament_target_dependencies( +target_link_libraries( @(cpp_node_name) @[ for dep in dependencies]@ - "@(dep)" + ${@(dep)_TARGETS} @[ end for]@ ) @[ end if]@ From a4e5ba9a89add5592c7645faa37fe1e0a97695b9 Mon Sep 17 00:00:00 2001 From: Shane Loretz Date: Sat, 8 Feb 2025 00:36:53 +0000 Subject: [PATCH 2/2] Use PUBLIC keyword by default for library Signed-off-by: Shane Loretz --- ros2pkg/ros2pkg/resource/ament_cmake/CMakeLists.txt.em | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ros2pkg/ros2pkg/resource/ament_cmake/CMakeLists.txt.em b/ros2pkg/ros2pkg/resource/ament_cmake/CMakeLists.txt.em index 6d0138f77..43ab8136b 100644 --- a/ros2pkg/ros2pkg/resource/ament_cmake/CMakeLists.txt.em +++ b/ros2pkg/ros2pkg/resource/ament_cmake/CMakeLists.txt.em @@ -29,7 +29,7 @@ target_include_directories(@(cpp_library_name) PUBLIC $) @[ if dependencies]@ target_link_libraries( - @(cpp_library_name) + @(cpp_library_name) PUBLIC @[ for dep in dependencies]@ ${@(dep)_TARGETS} @[ end for]@