I am trying out CMAKE_OPTIMIZE_DEPENDENCIES.
I did an experiment where I configured twice, once with COD=0, and again with COD=1. Then I wrote a little tool in Python that parsed the cmake-file-api reply for the codemodel, and went through every target and printed out the list of dependencies, as reported in the “dependencies” object of the target-xxx.json file.
When I do this, there are some targets where the dependency count increases with COD=1. I’ve read the documentation and I don’t see how this is possible. The documentation says that COD first removes all dependencies, and then only adds them back if certain conditions are met. This reads to me as though the number of direct + indirect dependencies must necessarily be less with COD=1 than it is with COD=0.
The only thing I’m not sure about is whether the dependencies reported in the file-api reply includes both direct + indirect, and the file-api documentation doesn’t make this clear either. If it reports direct+indirect, then I think this is a bug in the implementation of COD. If it only reports direct, then the behavior is probably correct.
Any advice appreciated.