<div dir="ltr"><div>Hi everyone!</div><div><br></div><div>I am trying to get a code generation tool to behave "the same as" a C source file with respect to dependencies. By that I mean, suppose you have a C file "a.c". Because it can #include files, every time the content of `a.c` changes, its dependencies may have changed also. The dependencies get rescanned with -MMD. I would like some way to emulate this for my code generator.</div><div><br></div><div>First I tried add_custom_command, which takes a fixed DEPENDS list, determined at the time the custom command is defined. Concretely, I mean something like this:</div><div><br></div><div>function(add_generated_library)</div><div>  figure_out_dependencies(deps ${ARGN})</div><div>  add_custom_command(... DEPENDS ${deps})<br>  ...<br>endfunction()</div><div><br></div><div>But that only captures the dependencies at build-system-generation time. Every time the custom command runs, the DEPENDS list may need to change, because the changes may imply new dependencies.</div><div><br></div><div>How should I go about doing this?<br><br>Thanks,<br>Ken</div></div>