Draft: cmLocalGenerator: support adding dependency info to link lines

Ben Boeckel requested to merge ben.boeckel/cmake:linkers-with-depfiles into master

Linkers have dependencies as well, so allow generators to detect when files they read change so that files may be relinked.

This adds support for depfiles to Makefiles and Ninja generators for GNU-like linkers. It's a fairly recent feature (mid-2020).

Things to consider for completing this MR:

  • input paths contain ../ in them; these likely need normalized
  • other generators should probably be supported
  • making the code far less repetitive; the local generator is doing work, but this info needs to be known at various places: what is the best place to house "does this target use depfiles and what file is it using" logic.

Cc: @marc.chevrier @kyle.edwards
Fixes: #22217 (closed)

Merge request reports