I would like to know if CMake provide a way of fixing dependencies for a particular targets.
The use-case is to build once, analyze result’s real dependencies with a custom script(linker map or dwarf+nm, gcc -M), and setting them in this “CMake dependencies cache”. For example, if lib A is composed of A.o B.o A.h B.h, an executable using only symbols/headers from A.o would not depend on B.o/B.h when it links on lib A.
If it’s not possible actually, would it be possible to modify CMake to create a disk cache for each dependencies. If this cache exist for a target, then CMake would pass any step where it populate the dependencies graph for this target, just relying on the cache information.
I tried to look at CMake code source, but it’s a bit complex, there seem to be different graphes? It’s hard for me to localize all the places in the code that would need to be bypassed if cache exist for this target (is just in AddTargetDepend okay?)
If you thinks it’s doable, with a bit of guidance regarding where to be careful, I would work on this.
If you think it’s doom to fail, what could I do then?