-
Notifications
You must be signed in to change notification settings - Fork 142
Description
I was going to open an issue to add the PRIVATE keyword to ament_taret_dependencies(), but instead I'm wondering if it is still necessary now that ROS 2 packages offer modern CMake targets.
A lot of code uses ament_target_dependencies() to make a target in one package depend on everything offered by another package, whether that uses old-style standard CMake variables or modern CMake targets.
ament_target_dependencies(${PROJECT_NAME}
rcl_logging_interface
rcpputils
rcutils
spdlog
)ament_target_dependencies() propagates include directories, compiler definitions, compiler flags, etc. However, target_link_libraries() with modern CMake targets should do all of that too. As far as I can tell, I can use target_link_library() calls with the targets that are now being exported from those packages.
target_link_libraries(${PROJECT_NAME} PRIVATE
rcpputils::rcpputils
rcutils::rcutils
spdlog::spdlog)
target_link_libraries(${PROJECT_NAME} PUBLIC
rcl_logging_interface::rcl_logging_interface)If I wanted to link against every target in an ament_cmake package, it looks like I could do:
target_link_libraries(${PROJECT_NAME} PRIVATE
${rcpputils_TARGETS}
${rcutils_TARGETS}
spdlog::spdlog)
target_link_libraries(${PROJECT_NAME} PUBLIC
${rcl_logging_interface_TARGETS})If ament_target_dependencies() is around just for convenience, it seems like the standard CMake way is equally convenient. What other value does ament_target_dependencies() provide? Can it be deprecated?