suggest generic message generation target to depend on with add_dependencies
Closed this issue · 4 comments
The current design of genmsg requires users to depend on the xyz_gencpp target to build c++ libraries against messages in the same package. This requires users to know about gencpp and causes an ugly reference to gencpp internals in userland CMakeLists.txt.
I suggest that instead genmsg should if possible provide a CMake target that users can depend on generically. If changed, this also affects
Could you please clarify what you mean. Perhaps by giving an example or sketching how you imagine the better approach.
If I understand cmake correctly, then currently the user has to write:
add_dependencies(some_target packagename_gencpp)
And instead of that, I would like users to be able to state:
add_dependencies(some_target packagename_messages)
or something similar, a target that is not generated by gencpp, but by genmsg. Not sure whether this also has technical benefits. I guess it also makes build a little slower, since fist all message generators would build messages, rather than only the c++ ones. But I hope the abstraction of message generation will make it easier for users to understand what is going on.
A generic target could easily be added which itself depends on all generators. But I would rather teach the users to depend on the specific message generator target than on a generic one. As you already pointed out that makes definitely a difference because it adds significant useless dependencies. And since the user has to anyway specify a dep it should be directly the right one.
For the generic target I would use a more descriptive suffix like _generate_messages
resulting in i.e. std_msgs_generate_messages
. Else the meaning of that target std_msgs_messages
would be difficult to understand again.
Maybe a compromise could be to give the current targets a more meaningfull
name, like packagename_generate_messages_cpp or something. We know what
gencpp means, but users seeing only message_generation and message_runtime
dependencies cannot guess that well.
On Sun, Jan 27, 2013 at 12:36 AM, Dirk Thomas notifications@github.comwrote:
A generic target could easily be added which itself depends on all
generators. But I would rather teach the users to depend on the specific
message generator target than on a generic one. As you already pointed out
that makes definitely a difference because it adds significant useless
dependencies. And since the user has to anyway specify a dep it should be
directly the right one.For the generic target I would use a more descriptive suffix like
_generate_messages resulting in i.e. std_msgs_generate_messages. Else the
meaning of that target std_msgs_messages would be difficult to understand
again.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/20#issuecomment-12744535.