ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

ament_cmake_* offers two different approaches to export dependencies:

  • The "classic" CMake approach to export CMake variables like <pkgname>_INCLUDE_DIRECTORIES, <pkgname>_LIBRARIES, etc.

    Related functions are ament_cmake_export_definitions, ament_cmake_export_dependencies, ament_cmake_export_include_directories, ament_cmake_export_libraries. Helper functions like ament_target_dependencies make it easier to use the CMake variables and add "all" of them to a given target.

  • The "modern" CMake approach to export targets.

    The function ament_cmake_export_interfaces does the "heavy lifting" as you mentioned.

A package can decide to use either approach (or both) and downstream packages can use available information accordingly.

Atm almost all ROS 2 packages use the classic approach. The desire / goal would be to use the latter approach everywhere since it provides a cleaner and more precise way (hence it is the modern version).

The the latter approach isn't used much (I am only aware of ament_index_cpp) it might be that the API provided isn't sufficient yet. It seems a function like ament_export_dependency but for the exported target case is missing.