Fix yarp_add_idl use when cross-compiling #2983
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In YARP are two CMake macros to run yarpidl programs,
yarp_idl_to_dirandyarp_add_idl.When cross-compiling (for exmaple for Android or iOS) , it is not possible for
yarp_idl_to_dirandyarp_add_idlto call theyarpidl_rosmsgandyarpidl_thriftprovided by the YARP that is used for linking the program, as that version tipically does not work for the system on which we are cross-compiling. For this reason, it is important that there is a way for users to specify manually theyarpidl_rosmsgandyarpidl_thriftexecutables thatyarp_idl_to_dirandyarp_add_idluse.Even before this PR,
yarp_idl_to_dirworks fine with cross-compilaton by specifing the CMake cache variablesYARPIDL_thrift_LOCATIONandYARPIDL_rosmsg_LOCATION. If this variables are not set, the one provided by the YARP used to link the applications are used instead.Before this PR,
yarp_add_idlwas not using the executable specified in theYARPIDL_thrift_LOCATIONandYARPIDL_rosmsg_LOCATIONvariable, while after this PR alsoyarp_add_idlworks fine in cross-compilation.