Skip to content

Commit

Permalink
Remove the use of ament_target_dependencies. (#105)
Browse files Browse the repository at this point in the history
We can just use target_link_libraries instead.

Signed-off-by: Chris Lalancette <[email protected]>
  • Loading branch information
clalancette authored Nov 27, 2023
1 parent 431bd99 commit 33231ea
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@ endif()
target_include_directories(${PROJECT_NAME} PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:include/${PROJECT_NAME}>")

ament_target_dependencies(${PROJECT_NAME}
"rclcpp"
"rcutils"
"std_msgs"
target_link_libraries(${PROJECT_NAME} PUBLIC
rclcpp::rclcpp
rcutils::rcutils
${std_msgs_TARGETS}
)

install(
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 33231ea

Please sign in to comment.