diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2023-02-10 23:42:02 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2023-02-10 23:42:02 (GMT) |
commit | b6a53822176d120d1daa2fef5e261186767ab007 (patch) | |
tree | c0de38dfc7d5b23a9f28772b0427b4cb0cd13b50 | |
parent | 0ace6053e8a09656f2548697a8c61b9ad60a3cad (diff) | |
download | CMake-b6a53822176d120d1daa2fef5e261186767ab007.zip CMake-b6a53822176d120d1daa2fef5e261186767ab007.tar.gz CMake-b6a53822176d120d1daa2fef5e261186767ab007.tar.bz2 |
Ninja: depend on language module information files directly
Now that `GetLinkedTargetDirectories` can get the exact dependencies,
use them to simplify the collation dependency graph.
-rw-r--r-- | Source/cmNinjaTargetGenerator.cxx | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 6f9bdbd..8663f46 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -1146,6 +1146,11 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements( cmNinjaBuild build(this->LanguageDyndepRule(language, config)); build.Outputs.push_back(this->GetDyndepFilePath(language, config)); + build.ImplicitOuts.push_back( + cmStrCat(this->Makefile->GetCurrentBinaryDirectory(), '/', + this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget), + this->GetGlobalGenerator()->ConfigDirectory(config), '/', + language, "Modules.json")); for (auto const& scanFiles : scanningFiles) { if (!scanFiles.ScanningOutput.empty()) { build.ExplicitDeps.push_back(scanFiles.ScanningOutput); @@ -1157,17 +1162,10 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements( this->WriteTargetDependInfo(language, config); - // Make sure dyndep files for all our dependencies have already - // been generated so that the '<LANG>Modules.json' files they - // produced as side-effects are available for us to read. - // Ideally we should depend on the '<LANG>Modules.json' files - // from our dependencies directly, but we don't know which of - // our dependencies produces them. Fixing this will require - // refactoring the Ninja generator to generate targets in - // dependency order so that we can collect the needed information. - this->GetLocalGenerator()->AppendTargetDepends( - this->GeneratorTarget, build.OrderOnlyDeps, config, fileConfig, - DependOnTargetArtifact); + for (std::string const& l : + this->GetLinkedTargetDirectories(language, config)) { + build.ImplicitDeps.push_back(cmStrCat(l, '/', language, "Modules.json")); + } this->GetGlobalGenerator()->WriteBuild(this->GetImplFileStream(fileConfig), build); |