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