cmake support for dyndep capability of ninja for own targets


I know ninja’s dyndep feature is used by cmake for fortran compiling (especially handling modules)
I would like to use these dyndep feature for the process of generating files in build step (only using ninja).
But unfortunately I don’t find any cmake commands for using this or for generating these dyndep files.
Is it possible to build in a “using ninjas dyndep” feature with supporting api?

Thanks in advance and best regards

No, there is no exposed support for dyndep support in add_custom_command. Generally, this requires more infrastructure and would not be a trivial addition.

That said, are you sure you need dyndep? What are you doing that you would need it? Usually add_custom_command(DEPFILE) would be sufficient.


Please have a look at:
generate files with ninja and cmake

We need to generate content from apriori unknown number of files and the output of the generator is also arbitrary.
We solved this by calling “cmake --build target” in ninja run. Unfortunately from ninja 1.10.0 on the ninja -t restat call breaks our build.
So we think that using dyndep files would be perfect for our needs, but there is no support in cmake of using this.

Best regards Frank