You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/Tutorials/Beginner-Client-Libraries/Pluginlib.rst
+35-6Lines changed: 35 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -73,24 +73,53 @@ The code above creates an abstract class called ``RegularPolygon``.
73
73
One thing to notice is the presence of the initialize method.
74
74
With ``pluginlib``, a constructor without parameters is required, so if any parameters to the class are needed, we use the initialize method to pass them to the object.
75
75
76
-
We need to make this header available to other classes, so open ``ros2_ws/src/polygon_base/CMakeLists.txt`` for editing.
77
-
Add the following lines after the ``ament_target_dependencies`` command:
76
+
We need to make this header available to other classes by exporting it as an interface library.
77
+
To do so, open ``~/ros2_ws/src/polygon_base/CMakeLists.txt`` for editing
78
+
and add the following lines after the ``find_package(pluginlib REQUIRED)`` command:
78
79
79
80
.. code-block:: cmake
80
81
81
-
install(
82
-
DIRECTORY include/
83
-
DESTINATION include
82
+
# Library (this will be used as the base class for plugins)
83
+
add_library(${PROJECT_NAME} INTERFACE)
84
+
add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
0 commit comments