rclcpp icon indicating copy to clipboard operation
rclcpp copied to clipboard

Shouldn't the node from rclcpp_components_register_node depend on the library?

Open peci1 opened this issue 7 months ago • 1 comments

I've just noticed the executable my_exec created by calling

rclcpp_components_register_node(my_lib PLUGIN "my::Lib" EXECUTABLE my_exec)

does not have CMake dependency on my_lib. That seems weird to me because when I rebuild the executable, CMake doesn't automatically trigger a rebuild of the library.

I know that purely technically the two do not directly depend on each other, but in any imaginable case, I think developers would want the lib to be rebuilt.

Adding this line fixes the problem:

  add_dependencies(my_exec my_lib)

peci1 avatar May 30 '25 20:05 peci1