Skip to content

[kilted] New Export / Deprecate ament_target_libraries - #47

Merged
rhaschke merged 2 commits into
moveit:ros2from
MetroRobotsForks:ros2
May 27, 2025
Merged

rhaschke merged 2 commits into
moveit:ros2from
MetroRobotsForks:ros2

Conversation

@DLu

@DLu DLu commented May 9, 2025

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread CMakeLists.txt Resolved
Co-authored-by: Alejandro Hernández Cordero <[email protected]>
@rhaschke
rhaschke merged commit 501ebba into moveit:ros2 May 27, 2025
nbbrooks added a commit to nbbrooks/moveit2 that referenced this pull request May 18, 2026
The previous ament_target_dependencies(... Boost ...) calls implicitly
linked every Boost component found by ConfigExtras.cmake
(chrono date_time filesystem iostreams program_options regex
serialization system thread). Replacing them with
target_link_libraries(... Boost::headers) dropped those compiled
components, breaking the link step on humble for any TU that uses
non-header-only Boost. Add the specific components each target needs:

- moveit_test_utils: + Boost::regex
  (robot_model_test_utils.cpp uses boost::split_regex / boost::regex)
- moveit_ompl_interface: + Boost::serialization
  (detail/constraints_library.hpp uses boost::serialization::map)
- moveit_ros_benchmarks: + Boost::filesystem + Boost::regex
  (BenchmarkExecutor.cpp uses both)

Also drop the random_numbers::random_numbers imported target in
moveit_kdl_kinematics_plugin -- that target was only added upstream in
moveit/random_numbers#47 (merged 2025-05-27, "[kilted]"), so it doesn't
exist on jazzy or humble and the CMake configure step fails there. Use
the variable form \${random_numbers_LIBRARIES} with a matching
target_include_directories so the build works across all supported
distros.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
nbbrooks added a commit to nbbrooks/moveit2 that referenced this pull request Jun 8, 2026
ament_target_dependencies was deprecated and removed upstream
(ament/ament_cmake#614). Replace it with explicit
target_link_libraries(... NAMESPACE::TARGET) calls across the
codebase, matching the ROS 2 Kilted-and-newer guidance.

Two subtleties needed extra care:

- ament_target_dependencies(... Boost ...) implicitly linked every
  Boost component found by ConfigExtras.cmake (chrono, date_time,
  filesystem, iostreams, program_options, regex, serialization,
  system, thread). A bare target_link_libraries(... Boost::headers)
  drops those compiled components and breaks any translation unit
  that uses non-header-only Boost. Targets that need them now name
  their components explicitly:
  - moveit_test_utils: + Boost::regex
    (robot_model_test_utils.cpp uses boost::split_regex / boost::regex)
  - moveit_ompl_interface: + Boost::serialization
    (detail/constraints_library.hpp uses boost::serialization::map)
  - moveit_ros_benchmarks: + Boost::filesystem + Boost::regex
    (BenchmarkExecutor.cpp uses both)

- The random_numbers::random_numbers imported target was only added
  upstream in moveit/random_numbers#47 (merged 2025-05-27, "[kilted]"),
  so it doesn't exist on jazzy or humble and the CMake configure step
  fails there. moveit_kdl_kinematics_plugin uses the variable form
  ${random_numbers_LIBRARIES} with a matching
  target_include_directories instead, so the build works across all
  supported distros.

Also add find_package(rviz2 REQUIRED) to moveit_ros_visualization so
that rviz2_VERSION is available for the Qt5/Qt6 selection introduced
in moveit#3707, and resolve merge conflicts with that PR.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
nbbrooks added a commit to nbbrooks/moveit2 that referenced this pull request Jun 14, 2026
ament_target_dependencies was deprecated and removed upstream
(ament/ament_cmake#614). Replace it with explicit
target_link_libraries(... NAMESPACE::TARGET) calls across the
codebase, matching the ROS 2 Kilted-and-newer guidance.

Two subtleties needed extra care:

- ament_target_dependencies(... Boost ...) implicitly linked every
  Boost component found by ConfigExtras.cmake (chrono, date_time,
  filesystem, iostreams, program_options, regex, serialization,
  system, thread). A bare target_link_libraries(... Boost::headers)
  drops those compiled components and breaks any translation unit
  that uses non-header-only Boost. Targets that need them now name
  their components explicitly:
  - moveit_test_utils: + Boost::regex
    (robot_model_test_utils.cpp uses boost::split_regex / boost::regex)
  - moveit_ompl_interface: + Boost::serialization
    (detail/constraints_library.hpp uses boost::serialization::map)
  - moveit_ros_benchmarks: + Boost::filesystem + Boost::regex
    (BenchmarkExecutor.cpp uses both)

- The random_numbers::random_numbers imported target was only added
  upstream in moveit/random_numbers#47 (merged 2025-05-27, "[kilted]"),
  so it doesn't exist on jazzy or humble and the CMake configure step
  fails there. moveit_kdl_kinematics_plugin uses the variable form
  ${random_numbers_LIBRARIES} with a matching
  target_include_directories instead, so the build works across all
  supported distros.

Also add find_package(rviz2 REQUIRED) to moveit_ros_visualization so
that rviz2_VERSION is available for the Qt5/Qt6 selection introduced
in moveit#3707, and resolve merge conflicts with that PR.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
nbbrooks added a commit to nbbrooks/moveit2 that referenced this pull request Jun 15, 2026
ament_target_dependencies was deprecated and removed upstream
(ament/ament_cmake#614). Replace it with explicit
target_link_libraries(... NAMESPACE::TARGET) calls across the
codebase, matching the ROS 2 Kilted-and-newer guidance.

Two subtleties needed extra care:

- ament_target_dependencies(... Boost ...) implicitly linked every
  Boost component found by ConfigExtras.cmake (chrono, date_time,
  filesystem, iostreams, program_options, regex, serialization,
  system, thread). A bare target_link_libraries(... Boost::headers)
  drops those compiled components and breaks any translation unit
  that uses non-header-only Boost. Targets that need them now name
  their components explicitly:
  - moveit_test_utils: + Boost::regex
    (robot_model_test_utils.cpp uses boost::split_regex / boost::regex)
  - moveit_ompl_interface: + Boost::serialization
    (detail/constraints_library.hpp uses boost::serialization::map)
  - moveit_ros_benchmarks: + Boost::filesystem + Boost::regex
    (BenchmarkExecutor.cpp uses both)

- The random_numbers::random_numbers imported target was only added
  upstream in moveit/random_numbers#47 (merged 2025-05-27, "[kilted]"),
  so it doesn't exist on jazzy or humble and the CMake configure step
  fails there. moveit_kdl_kinematics_plugin uses the variable form
  ${random_numbers_LIBRARIES} with a matching
  target_include_directories instead, so the build works across all
  supported distros.

Also add find_package(rviz2 REQUIRED) to moveit_ros_visualization so
that rviz2_VERSION is available for the Qt5/Qt6 selection introduced
in moveit#3707, and resolve merge conflicts with that PR.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
nbbrooks added a commit to moveit/moveit2 that referenced this pull request Jun 16, 2026
* Remove use of ament_target_dependencies

ament_target_dependencies was deprecated and removed upstream
(ament/ament_cmake#614). Replace it with explicit
target_link_libraries(... NAMESPACE::TARGET) calls across the
codebase, matching the ROS 2 Kilted-and-newer guidance.

Two subtleties needed extra care:

- ament_target_dependencies(... Boost ...) implicitly linked every
  Boost component found by ConfigExtras.cmake (chrono, date_time,
  filesystem, iostreams, program_options, regex, serialization,
  system, thread). A bare target_link_libraries(... Boost::headers)
  drops those compiled components and breaks any translation unit
  that uses non-header-only Boost. Targets that need them now name
  their components explicitly:
  - moveit_test_utils: + Boost::regex
    (robot_model_test_utils.cpp uses boost::split_regex / boost::regex)
  - moveit_ompl_interface: + Boost::serialization
    (detail/constraints_library.hpp uses boost::serialization::map)
  - moveit_ros_benchmarks: + Boost::filesystem + Boost::regex
    (BenchmarkExecutor.cpp uses both)

- The random_numbers::random_numbers imported target was only added
  upstream in moveit/random_numbers#47 (merged 2025-05-27, "[kilted]"),
  so it doesn't exist on jazzy or humble and the CMake configure step
  fails there. moveit_kdl_kinematics_plugin uses the variable form
  ${random_numbers_LIBRARIES} with a matching
  target_include_directories instead, so the build works across all
  supported distros.

Also add find_package(rviz2 REQUIRED) to moveit_ros_visualization so
that rviz2_VERSION is available for the Qt5/Qt6 selection introduced
in #3707, and resolve merge conflicts with that PR.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* Address review feedback: fix Qt linking and drop redundant link deps

Link the imported Qt targets (Qt${QT_VERSION_MAJOR}::Core/::Widgets)
instead of the undefined ${QT_CORE}/${QT_WIDGETS} variables, remove a
duplicate rviz_ogre_vendor::OgreMain, and drop redundant transitive
dependencies (rmw_implementation, urdfdom_headers) already provided by
rclcpp and urdfdom::urdf_parser.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* Remove redundant Qt discovery in moveit_setup_framework

The rviz2-version-based Qt selection already finds Qt before any rviz or
moveit dependency, so the second find_package(Qt6) block was redundant and
could pull in Qt6 even on the Qt5 path.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* Address review feedback: export Qt dep, drop unused Boost in benchmarks

Add Qt to moveit_setup_assistant's exported dependencies so downstream
consumers of its targets resolve the Qt imported targets. Drop the unused
Boost::regex/Boost::filesystem links (and their includes) from benchmarks,
which uses std::regex/std::filesystem.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* Address review feedback: link Boost::date_time, drop redundant class_loader

Link Boost::date_time in moveit_ros_benchmarks and moveit_ompl_interface,
which use boost::posix_time but only linked Boost::headers after the
ament_target_dependencies(... Boost) removal (the old call pulled in all
Boost components). The Boost::date_time imported target is already found
via ConfigExtras.cmake / the top-level find_package.

Drop the redundant class_loader::class_loader link from moveit_plan_execution
and moveit_kinematics_plugin_loader; pluginlib::pluginlib already re-exports
class_loader, and these targets only use the pluginlib wrapper
(<pluginlib/class_loader.hpp>), not class_loader directly.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* Address review feedback: export Qt Core/Widgets component packages

ament_export_dependencies(Qt${QT_VERSION_MAJOR}) emits find_dependency(Qt6)
in the package config, but find_package(Qt6) without COMPONENTS does not
define the Qt6::Core / Qt6::Widgets imported targets that the exported
targets link against. Downstream find_package(moveit_setup_framework) /
find_package(moveit_setup_assistant) would then fail to resolve those
targets.

Export the standalone Qt${QT_VERSION_MAJOR}Core / Qt${QT_VERSION_MAJOR}Widgets
packages instead, whose configs define Qt6::Core / Qt6::Widgets. The
component find_package already sets Qt6Core_FOUND / Qt6Widgets_FOUND, so
ament_export_dependencies accepts them.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* Address review feedback: link/export tf2_ros where used in public headers

moveit_robot_interaction and moveit_ros_occupancy_map_monitor use tf2_ros
(tf2_ros::Buffer) in their public headers but only received it transitively.
Link tf2_ros::tf2_ros (plus tf2/tf2_eigen, already used in robot_interaction's
sources) explicitly and export it via THIS_PACKAGE_INCLUDE_DEPENDS so
downstream consumers of those headers resolve the dependency. Also link
tf2_ros into the occupancy_map_server executable, which uses
tf2_ros::TransformListener/Buffer directly.

Clarify the moveit_ros_move_group umbrella INTERFACE target comment: it
exposes the capabilities API (moveit_move_group_capabilities_base);
moveit_move_group_default_capabilities is a runtime pluginlib plugin and is
intentionally excluded.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* Link tf2_geometry_msgs via its imported target, not ${tf2_geometry_msgs_TARGETS}

tf2_geometry_msgs is a plain C++ library package (not a rosidl interface
package), exporting a single imported target tf2_geometry_msgs::tf2_geometry_msgs
via ament_export_targets(). Linking that namespaced target is the idiomatic,
documented form for a library, and it fails loudly if the target is ever
missing -- whereas an undefined ${..._TARGETS} variable expands to empty and
silently drops the dependency. The _TARGETS variable form is reserved for
rosidl interface (msg/srv/action) packages, which generate multiple
typesupport targets with no single aggregate target on all distros.

No behavioral change: both forms resolve to the same target today.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants