File tree Expand file tree Collapse file tree 4 files changed +32
-11
lines changed
Expand file tree Collapse file tree 4 files changed +32
-11
lines changed Original file line number Diff line number Diff line change 1313# limitations under the License.
1414
1515# register node plugins
16- list (REMOVE_DUPLICATES _RCLCPP_COMPONENTS_PACKAGE_RESOURCE_INDICES)
17- foreach (resource_index ${_RCLCPP_COMPONENTS_PACKAGE_RESOURCE_INDICES} )
16+ # The internal data is stored in a project directory scoped properties to allow
17+ # registering the components from nested scopes in CMake, where variables
18+ # would not propagate out.
19+ get_property (_rclcpp_components_package_resource_indices
20+ DIRECTORY "${PROJECT_SOURCE_DIR} "
21+ PROPERTY _RCLCPP_COMPONENTS_PACKAGE_RESOURCE_INDICES
22+ )
23+ list (REMOVE_DUPLICATES _rclcpp_components_package_resource_indices)
24+ foreach (resource_index ${_rclcpp_components_package_resource_indices} )
25+ get_property (_rclcpp_components_nodes
26+ DIRECTORY "${PROJECT_SOURCE_DIR} "
27+ PROPERTY "_RCLCPP_COMPONENTS_${resource_index} __NODES"
28+ )
1829 ament_index_register_resource (
19- ${resource_index} CONTENT "${_RCLCPP_COMPONENTS_ ${resource_index} __NODES }" )
30+ ${resource_index} CONTENT "${_rclcpp_components_nodes } " )
2031endforeach ()
Original file line number Diff line number Diff line change @@ -64,15 +64,19 @@ macro(rclcpp_components_register_node target)
6464 endif ()
6565 set (component ${ARGS_PLUGIN} )
6666 set (node ${ARGS_EXECUTABLE} )
67- _rclcpp_components_register_package_hook ()
6867 set (_path "lib" )
6968 set (library_name "$<TARGET_FILE_NAME :${target} >" )
7069 if (WIN32 )
7170 set (_path "bin" )
7271 endif ()
73- set (_RCLCPP_COMPONENTS_${resource_index} __NODES
74- "${_RCLCPP_COMPONENTS_${resource_index} __NODES}${component} ;${_path} /$<TARGET_FILE_NAME :${target} >\n " )
75- list (APPEND _RCLCPP_COMPONENTS_PACKAGE_RESOURCE_INDICES ${resource_index} )
72+ set_property (
73+ DIRECTORY "${PROJECT_SOURCE_DIR} "
74+ APPEND_STRING PROPERTY _RCLCPP_COMPONENTS_${resource_index}__NODES
75+ "${component} ;${_path} /$<TARGET_FILE_NAME :${target} >\n " )
76+ set_property (
77+ DIRECTORY "${PROJECT_SOURCE_DIR} "
78+ APPEND PROPERTY _RCLCPP_COMPONENTS_PACKAGE_RESOURCE_INDICES
79+ ${resource_index} )
7680
7781 if (ARGS_NO_UNDEFINED_SYMBOLS AND WIN32 )
7882 message (WARNING "NO_UNDEFINED_SYMBOLS is enabled for target \" ${target} \" , but this is unsupported on windows." )
Original file line number Diff line number Diff line change @@ -47,7 +47,6 @@ macro(rclcpp_components_register_nodes target)
4747 endif ()
4848
4949 if (${ARGC} GREATER 0)
50- _rclcpp_components_register_package_hook ()
5150 set (_unique_names)
5251 foreach (_arg ${ARGS_UNPARSED_ARGUMENTS} )
5352 if (_arg IN_LIST _unique_names)
@@ -63,9 +62,14 @@ macro(rclcpp_components_register_nodes target)
6362 else ()
6463 set (_path "lib" )
6564 endif ()
66- set (_RCLCPP_COMPONENTS_${resource_index} __NODES
67- "${_RCLCPP_COMPONENTS_${resource_index} __NODES}${_arg} ;${_path} /$<TARGET_FILE_NAME :${target} >\n " )
68- list (APPEND _RCLCPP_COMPONENTS_PACKAGE_RESOURCE_INDICES ${resource_index} )
65+ set_property (
66+ DIRECTORY "${PROJECT_SOURCE_DIR} "
67+ APPEND_STRING PROPERTY _RCLCPP_COMPONENTS_${resource_index}__NODES
68+ "${_arg} ;${_path} /$<TARGET_FILE_NAME :${target} >\n " )
69+ set_property (
70+ DIRECTORY "${PROJECT_SOURCE_DIR} "
71+ APPEND PROPERTY _RCLCPP_COMPONENTS_PACKAGE_RESOURCE_INDICES
72+ ${resource_index} )
6973 endforeach ()
7074 endif ()
7175endmacro ()
Original file line number Diff line number Diff line change @@ -25,6 +25,8 @@ macro(_rclcpp_components_register_package_hook)
2525 endif ()
2626endmacro ()
2727
28+ _rclcpp_components_register_package_hook ()
29+
2830get_filename_component (@PROJECT_NAME@_SHARE_DIR "${@PROJECT_NAME@_DIR}" DIRECTORY )
2931set (@PROJECT_NAME @_NODE_TEMPLATE "${@PROJECT_NAME@_SHARE_DIR}/node_main.cpp.in" )
3032
You can’t perform that action at this time.
0 commit comments