Commit 09b9058
Fix ROS2 C++ build with proper ament CMake exports
This commit fixes the ROS2/colcon build integration by properly configuring
CMake exports for the ament ecosystem.
Changes:
- Add ament detection when not building as LF subproject
- Move install(EXPORT) from lib/CMakeLists.txt to root CMakeLists.txt
(required for ament compatibility - must be alongside ament_package())
- Add NAMESPACE to export for proper imported target creation
- Add ament_export_targets(), ament_export_include_directories(), and
ament_export_libraries() for full ament integration
The key insight is that ament's build system requires the export installation
and ament_package() to be in the same CMakeLists.txt file. Using namespaced
targets (reactor-cpp::reactor-cpp) ensures proper linkage through CMake's
imported target mechanism.
Related: lf-lang/lingua-franca#2580
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>1 parent d568ddd commit 09b9058
3 files changed
Lines changed: 25 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
12 | 19 | | |
13 | 20 | | |
14 | 21 | | |
| |||
71 | 78 | | |
72 | 79 | | |
73 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
| 68 | + | |
72 | 69 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
| 11 | + | |
21 | 12 | | |
22 | 13 | | |
0 commit comments