@@ -17,6 +17,7 @@ find_package(controller_manager REQUIRED)
17
17
find_package (hardware_interface REQUIRED)
18
18
find_package (pluginlib REQUIRED)
19
19
find_package (rclcpp REQUIRED)
20
+ find_package (rclcpp_lifecycle REQUIRED)
20
21
find_package (yaml_cpp_vendor REQUIRED)
21
22
22
23
find_package (gz_sim_vendor REQUIRED)
@@ -30,18 +31,23 @@ include_directories(include)
30
31
add_library (${PROJECT_NAME} -system SHARED
31
32
src/gz_ros2_control_plugin.cpp
32
33
)
34
+ add_library (${PROJECT_NAME} -system ::${PROJECT_NAME} -system ALIAS ${PROJECT_NAME} -system )
33
35
34
36
target_link_libraries (${PROJECT_NAME} -system
35
37
PUBLIC
36
38
gz-sim::gz-sim
37
39
gz-plugin::register
38
40
ament_index_cpp::ament_index_cpp
39
41
controller_manager::controller_manager
40
- hardware_interface::mock_components
41
- pluginlib::pluginlib
42
+ hardware_interface::hardware_interface
43
+ ${pluginlib_TARGETS}
42
44
rclcpp::rclcpp
43
45
rclcpp_lifecycle::rclcpp_lifecycle
44
46
)
47
+ target_include_directories (${PROJECT_NAME} -system PUBLIC
48
+ $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR} /include >
49
+ $<INSTALL_INTERFACE:include /${PROJECT_NAME} >
50
+ )
45
51
46
52
#########
47
53
@@ -51,22 +57,29 @@ add_library(gz_hardware_plugins SHARED
51
57
target_link_libraries (gz_hardware_plugins
52
58
PUBLIC
53
59
gz-sim::gz-sim
54
- hardware_interface::mock_components
60
+ hardware_interface::hardware_interface
55
61
rclcpp::rclcpp
56
62
rclcpp_lifecycle::rclcpp_lifecycle
57
63
)
58
64
59
- ## Install
65
+ # Install headers
66
+ install (DIRECTORY include /
67
+ DESTINATION include /${PROJECT_NAME}
68
+ )
69
+
70
+ # Install library and export targets
60
71
install (TARGETS
72
+ ${PROJECT_NAME} -system
61
73
gz_hardware_plugins
74
+ EXPORT export_${PROJECT_NAME}
62
75
ARCHIVE DESTINATION lib
63
76
LIBRARY DESTINATION lib
64
77
RUNTIME DESTINATION bin
65
78
)
66
79
67
- install (DIRECTORY
68
- include /
69
- DESTINATION include
80
+ install (EXPORT export_ ${PROJECT_NAME}
81
+ NAMESPACE ${PROJECT_NAME} ::
82
+ DESTINATION share/ ${PROJECT_NAME} /cmake
70
83
)
71
84
72
85
# Testing and linting
@@ -75,12 +88,18 @@ if(BUILD_TESTING)
75
88
ament_lint_auto_find_test_dependencies()
76
89
endif ()
77
90
91
+ # Export old-style CMake variables
78
92
ament_export_include_directories(include )
79
93
ament_export_libraries(${PROJECT_NAME} -system gz_hardware_plugins)
80
94
81
- # Install directories
82
- install (TARGETS ${PROJECT_NAME} -system
83
- DESTINATION lib
95
+ # Export modern CMake targets
96
+ ament_export_targets(
97
+ export_${PROJECT_NAME}
98
+ )
99
+
100
+ ament_export_dependencies(
101
+ controller_manager
102
+ hardware_interface
84
103
)
85
104
86
105
pluginlib_export_plugin_description_file(gz_ros2_control gz_hardware_plugins.xml)
0 commit comments