Ament best practice for sharing libraries

Yes, this will work. ament_export_libraries(...) is basically the equivalent to catkin_package(LIBRARIES ...).

A “better” / more modern way would be to generate a CMake file containing code to import the actual targets in downstream packages. This needs to steps:

  • install the generated file (example)
  • export the generated file (example)

The usage downstream is than also different: see example.

We only do this in very few cases yet but the goal is to use this approach in all packages.

2 Likes