summaryrefslogtreecommitdiffstats
path: root/Source/cmNinjaTargetGenerator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmNinjaTargetGenerator.cxx')
-rw-r--r--Source/cmNinjaTargetGenerator.cxx30
1 files changed, 25 insertions, 5 deletions
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index dabb078..2283923 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -1175,6 +1175,15 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements(
}
}
+ // Check if there are Fortran objects which need to participate in forwarding
+ // module requirements.
+ if (this->GeneratorTarget->HaveFortranSources(config) &&
+ !this->Configs[config].ScanningInfo.count("Fortran")) {
+ ScanningFiles files;
+ this->Configs[config].ScanningInfo["Fortran"].emplace_back(files);
+ this->WriteCompileRule("Fortran", config, WithScanning::Yes);
+ }
+
for (auto const& langScanningFiles : this->Configs[config].ScanningInfo) {
std::string const& language = langScanningFiles.first;
std::vector<ScanningFiles> const& scanningFiles = langScanningFiles.second;
@@ -1197,10 +1206,13 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements(
this->WriteTargetDependInfo(language, config);
- for (std::string const& l :
- this->GetLinkedTargetDirectories(language, config)) {
- build.ImplicitDeps.emplace_back(
- cmStrCat(l, '/', language, "Modules.json"));
+ auto const linked_directories =
+ this->GetLinkedTargetDirectories(language, config);
+ for (std::string const& l : linked_directories.Direct) {
+ build.ImplicitDeps.push_back(cmStrCat(l, '/', language, "Modules.json"));
+ }
+ for (std::string const& l : linked_directories.Forward) {
+ build.ImplicitDeps.push_back(cmStrCat(l, '/', language, "Modules.json"));
}
this->GetGlobalGenerator()->WriteBuild(this->GetImplFileStream(fileConfig),
@@ -1900,10 +1912,18 @@ void cmNinjaTargetGenerator::WriteTargetDependInfo(std::string const& lang,
Json::Value& tdi_linked_target_dirs = tdi["linked-target-dirs"] =
Json::arrayValue;
- for (std::string const& l : this->GetLinkedTargetDirectories(lang, config)) {
+ auto const linked_directories =
+ this->GetLinkedTargetDirectories(lang, config);
+ for (std::string const& l : linked_directories.Direct) {
tdi_linked_target_dirs.append(l);
}
+ Json::Value& tdi_forward_modules_from_target_dirs =
+ tdi["forward-modules-from-target-dirs"] = Json::arrayValue;
+ for (std::string const& l : linked_directories.Forward) {
+ tdi_forward_modules_from_target_dirs.append(l);
+ }
+
cmDyndepGeneratorCallbacks cb;
cb.ObjectFilePath = [this](cmSourceFile const* sf, std::string const& cnf) {
return this->GetObjectFilePath(sf, cnf);