Skip to content

Commit 0626031

Browse files
committed
Add optional ament packaging
Detect ament during ROS2 builds and export targets so reactor-cpp is discoverable by ament_target_dependencies.
1 parent aa4bfb6 commit 0626031

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ endif()
99

1010
project(${LIB_TARGET} LANGUAGES CXX VERSION 0.0.1)
1111

12+
if (NOT DEFINED LF_REACTOR_CPP_SUFFIX)
13+
find_package(ament_cmake QUIET)
14+
if(ament_cmake_FOUND)
15+
set(REACTOR_CPP_USE_AMENT ON)
16+
endif()
17+
endif()
18+
1219
# require C++17
1320
set(CMAKE_CXX_STANDARD 17)
1421
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -71,3 +78,9 @@ if (DEFINED LF_REACTOR_CPP_SUFFIX)
7178
else()
7279
install(DIRECTORY include/ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
7380
endif()
81+
82+
if (REACTOR_CPP_USE_AMENT)
83+
ament_export_targets(${LIB_TARGET}Config HAS_LIBRARY_TARGET)
84+
ament_export_include_directories(include)
85+
ament_package()
86+
endif()

package.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
<description>A C++ reactor runtime</description>
77
<maintainer email="[email protected]">user</maintainer>
88
<license>ISC License</license>
9+
<buildtool_depend>ament_cmake</buildtool_depend>
910
<export>
10-
<build_type>cmake</build_type>
11+
<build_type>ament_cmake</build_type>
1112
</export>
1213
</package>

0 commit comments

Comments
 (0)