I have project which builds a compiler plugin (target
plugin) and in another directory try to use the plugin (target
Therefore I need the plugin (which is basically just a shared object) to be compiled and linked before the object files of
simple are compiled.
Now I’mhaving some trouble communicating this to CMake:
- My first attempt was to add
add_dependencies(simple plugin). This doesn’t help at all with Ninja, but does build correctly with UNIX Makefiles.
- Then I tried to set the OBJECT_DEPENDS source file property for all source files to
plugin. This worked great in Ninja, but failed with “No rule to make target ‘plugin’” with Makefiles. This seems fair since “OBJECT_DEPENDS” is documented to contain full-paths. But I couldn’t figure out how to specify the path to the shared object (since generator expressions don’t work here)
Is there some trick to do this robustly?