From 33231ea90c35720963eb9961d49e013bee1d40ab Mon Sep 17 00:00:00 2001 From: Chris Lalancette Date: Mon, 27 Nov 2023 11:31:55 -0500 Subject: [PATCH] Remove the use of ament_target_dependencies. (#105) We can just use target_link_libraries instead. Signed-off-by: Chris Lalancette --- CMakeLists.txt | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5ae9bbe..0d0d431 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,11 +26,10 @@ endif() target_include_directories(${PROJECT_NAME} PUBLIC "$" "$") - -ament_target_dependencies(${PROJECT_NAME} - "rclcpp" - "rcutils" - "std_msgs" +target_link_libraries(${PROJECT_NAME} PUBLIC + rclcpp::rclcpp + rcutils::rcutils + ${std_msgs_TARGETS} ) install( @@ -88,8 +87,7 @@ if(BUILD_TESTING) ament_add_gtest(${PROJECT_NAME}-test_subscriber test/test_subscriber.cpp) if(TARGET ${PROJECT_NAME}-test_subscriber) - target_link_libraries(${PROJECT_NAME}-test_subscriber ${PROJECT_NAME}) - ament_target_dependencies(${PROJECT_NAME}-test_subscriber "rclcpp" "rclcpp_lifecycle" "sensor_msgs") + target_link_libraries(${PROJECT_NAME}-test_subscriber ${PROJECT_NAME} rclcpp::rclcpp rclcpp_lifecycle::rclcpp_lifecycle ${sensor_msgs_TARGETS}) endif() ament_add_gtest(${PROJECT_NAME}-test_synchronizer test/test_synchronizer.cpp) @@ -124,14 +122,12 @@ if(BUILD_TESTING) ament_add_gtest(${PROJECT_NAME}-test_fuzz test/test_fuzz.cpp SKIP_TEST) if(TARGET ${PROJECT_NAME}-test_fuzz) - target_link_libraries(${PROJECT_NAME}-test_fuzz ${PROJECT_NAME}) - ament_target_dependencies(${PROJECT_NAME}-test_fuzz "rclcpp" "sensor_msgs") + target_link_libraries(${PROJECT_NAME}-test_fuzz ${PROJECT_NAME} rclcpp::rclcpp ${sensor_msgs_TARGETS}) endif() ament_add_gtest(${PROJECT_NAME}-test_message_traits test/test_message_traits.cpp) if(TARGET ${PROJECT_NAME}-test_message_traits) - target_link_libraries(${PROJECT_NAME}-test_message_traits ${PROJECT_NAME}) - ament_target_dependencies(${PROJECT_NAME}-test_message_traits "rclcpp" "std_msgs") + target_link_libraries(${PROJECT_NAME}-test_message_traits ${PROJECT_NAME} rclcpp::rclcpp ${std_msgs_TARGETS}) endif() # Provides PYTHON_EXECUTABLE_DEBUG