-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add NAMESPACE support to ament_export_targets #498
Add NAMESPACE support to ament_export_targets #498
Conversation
* Remove legacy ament functions * Add ament_export_targets * Match namespace for conan and ROS * Depends on ament/ament_cmake#498 merging and backport to humble * Add CI for export tests and colcon building Signed-off-by: Ryan Friedman <[email protected]>
Ready for review! I tested this with BTCPP, and it works great! The only thing this needs is a proper docstring for the new |
* Remove legacy ament functions * Add ament_export_targets * Match namespace for conan and ROS * Depends on ament/ament_cmake#498 merging and backport to humble * Add CI for export tests and colcon building Signed-off-by: Ryan Friedman <[email protected]>
Signed-off-by: Ryan Friedman <[email protected]>
4c3d9b1
to
71a967f
Compare
Upon discussion, there is no reason to prevent users from doing this, but it definitely not be the default as the expected behavior from calling Do you mind adding some documentation to this effect? Something along the lines of "this should be used carefully and documented in any packages that make use of this." |
Yep! Can do. It's an "advanced" option for sure. |
Signed-off-by: Ryan Friedman <[email protected]>
* Note it as an advanced feature * Recommend users document if using NAMESPACE * Follow CMinx format for keyword arguments: https://cmakepp.github.io/CMinx/documenting/macro.html Signed-off-by: Ryan Friedman <[email protected]>
Done! Ready for another pass. |
Can we backport to iron and humble? |
@Mergifyio backport humble |
✅ Backports have been created
|
* Add NAMESPACE support to ament_export_targets * Improve documentation for NAMESPACE argument Signed-off-by: Ryan Friedman <[email protected]> (cherry picked from commit 7fdd2d1)
* Add NAMESPACE support to ament_export_targets * Improve documentation for NAMESPACE argument Signed-off-by: Ryan Friedman <[email protected]> (cherry picked from commit 7fdd2d1) Co-authored-by: Ryan <[email protected]>
Purpose
I want to export targets with ament but under a custom namespace. Currently, it's hard coded to be the project name. The intent is to make this backwards compatible with humble, and obvious to people who have used CMake
install(EXPORT ... NAMESPACE foo)
that it does the same thing.Motivation
#292 (comment)
BehaviorTree/BehaviorTree.CPP#751 (comment)
Example usage in BehaviorTreeCPP
Top level CMakeLists.txt
ament_build.cmake
Then, to use the library, whether you consume it build with ament or conan enabled, you can always call either of the two.
using ament_target_dependencies - sadly this exposes the BTCPP to the public interface even if it's an implementation detail. This only matters if you are building a re-usable library and don't want your consumers know you use BTCPP.
OR , the preferred approach:
Feel free to take a look at the full branch here: https://github.com/Ryanf55/BehaviorTree.CPP/tree/751-use-ament-export-targets
Assumptions
Risks
There's this assumption the target name would never have colons, however it doesn't seem to have any ill effect
https://cmake.org/cmake/help/latest/manual/cmake-language.7.html#variables