rclcpp
rclcpp copied to clipboard
Shouldn't the node from rclcpp_components_register_node depend on the library?
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)