Transitive dependency not working with INTERFACE library
In a larger project that I work on, I noticed that when adding a direct dependency on an INTERFACE
library, the dependencies from the INTERFACE
library did not seem to be transitively propagating. I've created a simplified example that you can use to recreate the behavior:
CMakeLists.txt main.cc normal_lib.h normal_lib.cc
The my_custom_command
should have a dependency on my_custom_lib_name
, which is really just a library called normal_lib
. If we use ninja's dependency graphing, we can see that my_custom_command
does not depend on normal_lib
:
ninja -t graph my_custom_command | dot -Tpng -ograph.png
:
If you change the last line in the CMakeLists.txt
to add a direct dependency on normal_lib
, we can see the correct dependency: