summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefileTargetGenerator.cxx
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2023-02-01 03:13:56 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2023-02-01 03:34:29 (GMT)
commit837f7c113a9333997304c3b5742c922617da23b5 (patch)
tree19e0f56c92675f0095786d51abb968d5ac63701d /Source/cmMakefileTargetGenerator.cxx
parentd19648a9286d0943858ea0c5dc5e13d3b735b129 (diff)
downloadCMake-837f7c113a9333997304c3b5742c922617da23b5.zip
CMake-837f7c113a9333997304c3b5742c922617da23b5.tar.gz
CMake-837f7c113a9333997304c3b5742c922617da23b5.tar.bz2
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.
Diffstat (limited to 'Source/cmMakefileTargetGenerator.cxx')
-rw-r--r--Source/cmMakefileTargetGenerator.cxx2
1 files changed, 1 insertions, 1 deletions
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 4f80edc..c40d685 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -1498,7 +1498,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
"set(CMAKE_Fortran_TARGET_LINKED_INFO_FILES\n";
/* clang-format on */
std::vector<std::string> dirs =
- this->GetLinkedTargetDirectories(this->GetConfigName());
+ this->GetLinkedTargetDirectories("Fortran", this->GetConfigName());
for (std::string const& d : dirs) {
*this->InfoFileStream << " \"" << d << "/DependInfo.cmake\"\n";
}