Adding #include-depedencies from add_custom_command output to its input

Hello!

I use add_custom_command to generate C-Files during the build.
(if it matters, it’s the Oracle Pro*C precompiler)

The input and the output file both have #include statements. (Pro*C is just plain C plus inline SQL code)

When I modify a header which the generated .c file #includes, it’s automatically rebuilt. So far so good, everything works as usual.

But in this case of a modified header, I would also need to re-run the add_custom_command, because it also depends on the #included files.

Phrasing it another way - when the output is out-of-date, the input should also be considered out-of-date, too.

Is it possible to apply the rules of automatic #include dependency detection for .c files also to input files of add_custom_command?

I don’t want to add a DEPENDS statements to the add_custom_command, because those would need to be updated if an #include in the input is updated.
If this can be done with IMPLICIT_DEPENDS, could you provide a trivial example?

I am using Unix Makefiles, so if there is no general solution, a solution which only works for Unix Makefiles would suffice.

No, it is not possible to apply the rules of automatic #include dependency detection for .c files also to input files of add_custom_command but you can use DEPFILE option of add_custom_command to manage dependencies of your input file.