Compiler wrongly uses installed version of files (as opposed to local ones) to compile when using the plugin architecture
Consider the following scenario:
- plugin
B
requires pluginA
- plugin
B
has already been installed, but we are working on some modifications (on our local copy obviously) - plugin
B
has a file calledfoo.h
with the following lines:
#include A/pluginA.h //external dependency
#include B/pluginB.h //internal dependency
Because both plugins are installed, /usr/local/iri-algorithms/wolf/
will have (at least) two folders:
A/
B/
And moreover, we will have
/usr/local/iri-algorithms/wolf/A/pluginA.h
/usr/local/iri-algorithms/wolf/B/pluginB.h
Now keep in mind that the file pluginB.h
also resides locally in local/include/pluginB.h
and is the file that we are now modifying.
Because plugin B
requires plugin A
, CMake will add /usr/local/iri-algorithms/wolf/
as a path to look for includes in order to find the file A/pluginA.h
. But, somehow, CMake sets up the include search path in a way that the compiler looks first at /usr/local/iri-algorithms/wolf/
and only after looks at the local include folder. Therefore, the compiler will use the old version (/usr/local/iri-algorithms/wolf/B/pluginB.h
) to compile instead of local/include/pluginB.h
.
The problem arises from the fact that the include path required for any plugin is the same (/usr/local/iri-algorithms/wolf/
). An easy fix would be to modify the installing path with something like /usr/local/iri-algorithms/wolf/A/A
so that we can keep the name of the plugin in the include.
If we want to start working with plugins that have dependencies this needs to be fixed, specially because a standard use case is that of a user that has their own plugin installed while modifying it (for instance because they are using their plugin in some ROS node).