Skip to content

Commit c07db0b

Browse files
Merge pull request #54 from PickNikRobotics/remove_ament_target
Remove ament_target_dependencies usage
2 parents 1085e00 + 71f9ea7 commit c07db0b

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

data_tamer_cpp/CMakeLists.txt

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,23 @@ if (DATA_TAMER_BUILD_ROS)
104104
find_package(rclcpp_lifecycle REQUIRED)
105105
find_package(data_tamer_msgs REQUIRED)
106106

107-
ament_target_dependencies(data_tamer mcap_vendor rclcpp rclcpp_lifecycle data_tamer_msgs)
107+
target_include_directories(data_tamer PUBLIC
108+
${mcap_vendor_INCLUDE_DIRS}
109+
${rclcpp_INCLUDE_DIRS}
110+
${rclcpp_lifecycle_INCLUDE_DIRS}
111+
${data_tamer_msgs_INCLUDE_DIRS}
112+
)
113+
114+
# we need to find the underlying library for `target_link_libraries` to work
115+
find_library(MCAP_LIBRARY mcap PATHS ${mcap_vendor_LIBRARY_DIRS})
116+
117+
target_link_libraries(data_tamer PUBLIC
118+
${mcap_vendor_LIBRARIES}
119+
${rclcpp_LIBRARIES}
120+
${rclcpp_lifecycle_LIBRARIES}
121+
${data_tamer_msgs_LIBRARIES}
122+
${MCAP_LIBRARY}
123+
)
108124

109125
ament_export_targets(data_tamerTargets HAS_LIBRARY_TARGET)
110126
ament_export_dependencies(mcap_vendor rclcpp rclcpp_lifecycle data_tamer_msgs)

data_tamer_cpp/examples/CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,13 @@ target_include_directories(mcap_reader
1818
# optionally build for ROS 2
1919
option(DATA_TAMER_BUILD_ROS "Build for ROS 2" ON)
2020
if ( DATA_TAMER_BUILD_ROS AND ament_cmake_FOUND )
21-
ament_target_dependencies(mcap_reader mcap_vendor)
21+
target_include_directories(mcap_reader PUBLIC
22+
${mcap_vendor_INCLUDE_DIRS}
23+
)
24+
target_link_libraries(mcap_reader
25+
data_tamer
26+
${mcap_vendor_LIBRARIES}
27+
)
2228

2329
CompileExample(ros2_publisher)
2430

0 commit comments

Comments
 (0)