summaryrefslogtreecommitdiffstats
path: root/Source/cmNinjaTargetGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-11-27 13:36:28 (GMT)
committerKitware Robot <kwrobot@kitware.com>2023-11-27 13:36:44 (GMT)
commit4b2960b1f3e214dd30b32925b00eef5f64b99b71 (patch)
tree106a8dc355a73556244ba1701b38faab5181a240 /Source/cmNinjaTargetGenerator.cxx
parent66149dd1a93f4f22f68d7465de74b14d7c03f89d (diff)
parentbeb1393f8f29302197b80741bec41a13b7f207c7 (diff)
downloadCMake-4b2960b1f3e214dd30b32925b00eef5f64b99b71.zip
CMake-4b2960b1f3e214dd30b32925b00eef5f64b99b71.tar.gz
CMake-4b2960b1f3e214dd30b32925b00eef5f64b99b71.tar.bz2
Merge topic 'fortran-objects-as-sources-fix' into release-3.28
beb1393f8f Merge branch 'revert-exact-collation-depends-3.27' into fortran-objects-as-sources-fix a033dce326 Makefiles: provide, but do not consume, "forward linked" target dirs 7cd0adab1b cmCommonTargetGenerator: use modules from linked object-referenced targets 1175f1c874 LinkItem: track `cmSourceFile` instances for external objects d2fa56772f Ninja: support "forwarding" modules from other targets ec1e589bec Ninja: Revert exact collation dependencies for 3.27 06df59b930 cmCommonTargetGenerator: return forward linked target dirs too f8729ab366 cmLocalUnixMakefileGenerator3: handle object-referencing Fortran modules ... Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !8989
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);