cmCommonTargetGenerator: classify linked target directories by language
These directories are used to direct collators for Fortran and C++ modules to consume dependent module information to properly collate. However, the consumption of these files merely checks for existence of the file, not whether they are actually needed anymore.
The problem arises when a target has Fortran or C++ modules at point A,
a build occurs populating this file, and then the target is updated to
no longer have potential modules. The DependInfo.make
(for
Makefiles
) or <LANG>DependInfo.json
(for Ninja
) files still exist
as they are never guaranteed to be cleaned up. This can introduce stale
information to the build which may cause a false-positive compilation if
a module file happens to still exist and gets found this way.
Instead, query the linked-target-dirs
using the language in question
and only add the directory if it contains potential sources for modules
coming from the language in question.
Backport: release