diff options
author | Sebastian Holtermann <sebholt@xwmw.org> | 2019-05-30 15:29:06 (GMT) |
---|---|---|
committer | Sebastian Holtermann <sebholt@xwmw.org> | 2019-05-30 16:38:21 (GMT) |
commit | ccf950795666406e59f420fd2732149711cb0362 (patch) | |
tree | 1698a81dc6bcde963802d70e18a9bb2155f33599 | |
parent | df06c8d7921d09a2a627731866a8ce895990067b (diff) | |
download | CMake-ccf950795666406e59f420fd2732149711cb0362.zip CMake-ccf950795666406e59f420fd2732149711cb0362.tar.gz CMake-ccf950795666406e59f420fd2732149711cb0362.tar.bz2 |
Ninja: Use cmNinjaBuild class for WriteBuild
-rw-r--r-- | Source/cmGlobalNinjaGenerator.cxx | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index ed604d9..db0e01c 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -1940,32 +1940,29 @@ bool cmGlobalNinjaGenerator::WriteDyndepFile( cmGeneratedFileStream ddf(arg_dd); ddf << "ninja_dyndep_version = 1.0\n"; - for (cmDyndepObjectInfo const& object : objects) { - std::string const ddComment; - std::string const ddRule = "dyndep"; - cmNinjaDeps ddOutputs; - cmNinjaDeps ddImplicitOuts; - cmNinjaDeps ddExplicitDeps; - cmNinjaDeps ddImplicitDeps; - cmNinjaDeps ddOrderOnlyDeps; - cmNinjaVars ddVars; - - ddOutputs.push_back(object.Object); - for (std::string const& p : object.Provides) { - ddImplicitOuts.push_back(this->ConvertToNinjaPath(mod_files[p])); - } - for (std::string const& r : object.Requires) { - std::map<std::string, std::string>::iterator m = mod_files.find(r); - if (m != mod_files.end()) { - ddImplicitDeps.push_back(this->ConvertToNinjaPath(m->second)); + { + cmNinjaBuild build("dyndep"); + build.Outputs.emplace_back(""); + for (cmDyndepObjectInfo const& object : objects) { + build.Outputs[0] = object.Object; + build.ImplicitOuts.clear(); + for (std::string const& p : object.Provides) { + build.ImplicitOuts.push_back(this->ConvertToNinjaPath(mod_files[p])); + } + build.ImplicitDeps.clear(); + for (std::string const& r : object.Requires) { + auto mit = mod_files.find(r); + if (mit != mod_files.end()) { + build.ImplicitDeps.push_back(this->ConvertToNinjaPath(mit->second)); + } + } + build.Variables.clear(); + if (!object.Provides.empty()) { + build.Variables.emplace("restat", "1"); } - } - if (!object.Provides.empty()) { - ddVars["restat"] = "1"; - } - this->WriteBuild(ddf, ddComment, ddRule, ddOutputs, ddImplicitOuts, - ddExplicitDeps, ddImplicitDeps, ddOrderOnlyDeps, ddVars); + this->WriteBuild(ddf, build); + } } // Store the map of modules provided by this target in a file for |