[ros-users] [Discourse.ros.org] [Next Generation ROS] Ament best practice for sharing libraries

Dirk Thomas ros.discourse at gmail.com
Fri Jan 5 21:57:20 UTC 2018



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](https://github.com/ament/ament_index/blob/1df2aef4d7f1271d80082cc01aa08e13bfc58fce/ament_index_cpp/CMakeLists.txt#L51))
* export the generated file ([example](https://github.com/ament/ament_index/blob/1df2aef4d7f1271d80082cc01aa08e13bfc58fce/ament_index_cpp/CMakeLists.txt#L30))

The usage downstream is than also different: see [example](https://github.com/ros2/demos/blob/23b3bb5807223673cfd3f5e5652e8b0fe2568d7d/composition/CMakeLists.txt#L120).

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





---
[Visit Topic](https://discourse.ros.org/t/ament-best-practice-for-sharing-libraries/3602/2) or reply to this email to respond.




More information about the ros-users mailing list