# How to properly use buildtool dependency for cross-compilation

So I have the following scenario.

• Package L which provides a library (i.e. serialization Library).
• Package G which only autogenerates some code (i.e. Generates source code for messages).
• Package P which contains data for autogeneration (i.e. message definitions) and uses them in source files.

As far as I understand, the proper way of defining dependencies here are:

1. Package P should buildtool_depend on G, as it needs to use the autogeneration scripts.
2. Package P should build_depend on L, as it needs its library.

First question: Is there any way to properly specify the dependency in point 2. in the package G? Because doing build_export_depend of L on package B can lead to adding unnecessary dependencies (for instance if we want to extend the package G with a G2 package).

In a cross-compilation setup, the package L should be compiled together with package P for the target, while package G is a native dependency. Second question: Is there a way of making this clear in the package.xml?

Thanks!

Note: The scenario I am describing here is very similar to what happens with message_generation and message_runtime packages. runtime package run_depends on roscpp_serialization. In the analogy, my package L would be roscpp_serialization, the package G would be both message_generation and message_runtime, and the package P would be any package creating and using a ROS message, which requires a specific set of dependencies. The point here is that I find this division of package G a bit weird, as message_generation should be a builtool_depend but it is said to be used as a build_depend.

edit retag close merge delete