From 15c644437ae355ac196cfcfe1e874d8280451b43 Mon Sep 17 00:00:00 2001
From: Sebastian Holtermann <sebholt@xwmw.org>
Date: Thu, 30 May 2019 11:15:07 +0200
Subject: Ninja: Add cmNinjaBuild based WriteBuild (wrapper) method

---
 Source/cmGlobalNinjaGenerator.cxx | 10 ++++++++++
 Source/cmGlobalNinjaGenerator.h   |  7 +++++++
 2 files changed, 17 insertions(+)

diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 3fce29e..c362dc6 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -226,6 +226,16 @@ void cmGlobalNinjaGenerator::WriteBuild(
   os << buildstr << arguments << assignments;
 }
 
+void cmGlobalNinjaGenerator::WriteBuild(std::ostream& os,
+                                        cmNinjaBuild const& build,
+                                        int cmdLineLimit,
+                                        bool* usedResponseFile)
+{
+  WriteBuild(os, build.Comment, build.Rule, build.Outputs, build.ImplicitOuts,
+             build.ExplicitDeps, build.ImplicitDeps, build.OrderOnlyDeps,
+             build.Variables, build.RspFile, cmdLineLimit, usedResponseFile);
+}
+
 void cmGlobalNinjaGenerator::WritePhonyBuild(
   std::ostream& os, const std::string& comment, const cmNinjaDeps& outputs,
   const cmNinjaDeps& explicitDeps, const cmNinjaDeps& implicitDeps,
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index dcc358b..037c20e 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -117,6 +117,13 @@ public:
                   int cmdLineLimit = 0, bool* usedResponseFile = nullptr);
 
   /**
+   * Write a build statement @a build to @a os.
+   * @warning no escaping of any kind is done here.
+   */
+  void WriteBuild(std::ostream& os, cmNinjaBuild const& build,
+                  int cmdLineLimit = 0, bool* usedResponseFile = nullptr);
+
+  /**
    * Helper to write a build statement with the special 'phony' rule.
    */
   void WritePhonyBuild(std::ostream& os, const std::string& comment,
-- 
cgit v0.12