@@ -30,6 +30,25 @@ endforeach()
3030
3131include_directories (include )
3232
33+ add_library (moveit_servo_dependency_targets INTERFACE )
34+ target_link_libraries (
35+ moveit_servo_dependency_targets
36+ INTERFACE ${control_msgs_TARGETS}
37+ ${geometry_msgs_TARGETS}
38+ moveit_core::moveit_core
39+ ${moveit_msgs_TARGETS}
40+ ${moveit_ros_planning_TARGETS}
41+ ${moveit_ros_planning_interface_TARGETS}
42+ pluginlib::pluginlib
43+ rclcpp::rclcpp
44+ rclcpp_components::component
45+ realtime_tools::realtime_tools
46+ ${sensor_msgs_TARGETS}
47+ ${std_msgs_TARGETS}
48+ ${std_srvs_TARGETS}
49+ tf2_eigen::tf2_eigen
50+ ${trajectory_msgs_TARGETS} )
51+
3352# ##############################################################################
3453# C++ Libraries ##
3554# ##############################################################################
@@ -45,14 +64,18 @@ add_library(
4564 src/utils/common.cpp src/utils/command .cpp)
4665set_target_properties (moveit_servo_lib_cpp PROPERTIES VERSION
4766 "${moveit_servo_VERSION} " )
48- target_link_libraries (moveit_servo_lib_cpp moveit_servo_lib_parameters)
49- ament_target_dependencies(moveit_servo_lib_cpp ${THIS_PACKAGE_INCLUDE_DEPENDS} )
67+ target_link_libraries (
68+ moveit_servo_lib_cpp
69+ PUBLIC moveit_servo_dependency_targets
70+ moveit_servo_lib_parameters)
5071
5172add_library (moveit_servo_lib_ros SHARED src/servo_node.cpp)
5273set_target_properties (moveit_servo_lib_ros PROPERTIES VERSION
5374 "${moveit_servo_VERSION} " )
54- target_link_libraries (moveit_servo_lib_ros moveit_servo_lib_cpp)
55- ament_target_dependencies(moveit_servo_lib_ros ${THIS_PACKAGE_INCLUDE_DEPENDS} )
75+ target_link_libraries (
76+ moveit_servo_lib_ros
77+ PUBLIC moveit_servo_dependency_targets
78+ moveit_servo_lib_cpp)
5679
5780# ##############################################################################
5881# Components ##
@@ -67,28 +90,27 @@ rclcpp_components_register_node(moveit_servo_lib_ros PLUGIN
6790
6891# Executable node for the joint jog demo
6992add_executable (demo_joint_jog demos/cpp_interface/demo_joint_jog.cpp)
70- target_link_libraries (demo_joint_jog moveit_servo_lib_cpp)
71- ament_target_dependencies(demo_joint_jog ${THIS_PACKAGE_INCLUDE_DEPENDS} )
93+ target_link_libraries (demo_joint_jog PRIVATE moveit_servo_lib_cpp)
7294
7395# Executable node for the twist demo
7496add_executable (demo_twist demos/cpp_interface/demo_twist.cpp)
75- target_link_libraries (demo_twist moveit_servo_lib_cpp)
76- ament_target_dependencies(demo_twist ${THIS_PACKAGE_INCLUDE_DEPENDS} )
97+ target_link_libraries (demo_twist PRIVATE moveit_servo_lib_cpp)
7798
7899# Executable node for the pose demo
79100add_executable (demo_pose demos/cpp_interface/demo_pose.cpp)
80- target_link_libraries (demo_pose moveit_servo_lib_cpp)
81- ament_target_dependencies(demo_pose ${THIS_PACKAGE_INCLUDE_DEPENDS} )
101+ target_link_libraries (demo_pose PRIVATE moveit_servo_lib_cpp)
82102
83103# Keyboard control example for servo
84104add_executable (servo_keyboard_input demos/servo_keyboard_input.cpp)
85105target_include_directories (servo_keyboard_input PUBLIC include )
86- ament_target_dependencies (servo_keyboard_input ${THIS_PACKAGE_INCLUDE_DEPENDS} )
106+ target_link_libraries (servo_keyboard_input PRIVATE moveit_servo_dependency_targets )
87107
88108# ##############################################################################
89109# Install ##
90110# ##############################################################################
91111
112+ install (TARGETS moveit_servo_dependency_targets EXPORT moveit_servoTargets)
113+
92114# Install Libraries
93115install (
94116 TARGETS moveit_servo_lib_cpp moveit_servo_lib_ros moveit_servo_lib_parameters
@@ -120,26 +142,23 @@ if(BUILD_TESTING)
120142 find_package (ros_testing REQUIRED)
121143
122144 ament_add_gtest_executable(moveit_servo_utils_test tests/test_utils.cpp)
123- target_link_libraries (moveit_servo_utils_test moveit_servo_lib_cpp)
124- ament_target_dependencies(moveit_servo_utils_test
125- ${THIS_PACKAGE_INCLUDE_DEPENDS} )
145+ target_link_libraries (moveit_servo_utils_test PRIVATE moveit_servo_lib_cpp)
126146 add_ros_test(tests/launch/servo_utils.test .py TIMEOUT 30 ARGS
127147 "test_binary_dir:=${CMAKE_CURRENT_BINARY_DIR} " )
128148
129149 ament_add_gtest_executable(
130150 moveit_servo_cpp_integration_test tests/test_integration.cpp
131151 tests/servo_cpp_fixture.hpp)
132- target_link_libraries (moveit_servo_cpp_integration_test moveit_servo_lib_cpp)
133- ament_target_dependencies(moveit_servo_cpp_integration_test
134- ${THIS_PACKAGE_INCLUDE_DEPENDS} )
152+ target_link_libraries (moveit_servo_cpp_integration_test
153+ PRIVATE moveit_servo_lib_cpp)
135154 add_ros_test(tests/launch/servo_cpp_integration.test .py TIMEOUT 30 ARGS
136155 "test_binary_dir:=${CMAKE_CURRENT_BINARY_DIR} " )
137156
138157 ament_add_gtest_executable(
139158 moveit_servo_ros_integration_test tests/test_ros_integration.cpp
140159 tests/servo_ros_fixture.hpp)
141- ament_target_dependencies (moveit_servo_ros_integration_test
142- ${THIS_PACKAGE_INCLUDE_DEPENDS} )
160+ target_link_libraries (moveit_servo_ros_integration_test
161+ PRIVATE moveit_servo_lib_ros )
143162 add_ros_test(tests/launch/servo_ros_integration.test .py TIMEOUT 120 ARGS
144163 "test_binary_dir:=${CMAKE_CURRENT_BINARY_DIR} " )
145164
0 commit comments