From 2f4075fa45a180dce701295dbabb131518652221 Mon Sep 17 00:00:00 2001
From: Frank Goyens <frank.goyens@delem.com>
Date: Fri, 29 Jun 2018 15:39:52 +0200
Subject: VS: moved EscapeForXML function higher up and made static

---
 Source/cmLocalVisualStudio7Generator.cxx | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 4b0b66d..2c1a95c 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -1233,6 +1233,18 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
   }
 }
 
+static std::string cmLocalVisualStudio7GeneratorEscapeForXML(
+  const std::string& s)
+{
+  std::string ret = s;
+  cmSystemTools::ReplaceString(ret, "&", "&amp;");
+  cmSystemTools::ReplaceString(ret, "\"", "&quot;");
+  cmSystemTools::ReplaceString(ret, "<", "&lt;");
+  cmSystemTools::ReplaceString(ret, ">", "&gt;");
+  cmSystemTools::ReplaceString(ret, "\n", "&#x0D;&#x0A;");
+  return ret;
+}
+
 void cmLocalVisualStudio7Generator::OutputDeploymentDebuggerTool(
   std::ostream& fout, std::string const& config, cmGeneratorTarget* target)
 {
@@ -2056,17 +2068,6 @@ void cmLocalVisualStudio7Generator::WriteVCProjFooter(
        << "</VisualStudioProject>\n";
 }
 
-std::string cmLocalVisualStudio7GeneratorEscapeForXML(const std::string& s)
-{
-  std::string ret = s;
-  cmSystemTools::ReplaceString(ret, "&", "&amp;");
-  cmSystemTools::ReplaceString(ret, "\"", "&quot;");
-  cmSystemTools::ReplaceString(ret, "<", "&lt;");
-  cmSystemTools::ReplaceString(ret, ">", "&gt;");
-  cmSystemTools::ReplaceString(ret, "\n", "&#x0D;&#x0A;");
-  return ret;
-}
-
 std::string cmLocalVisualStudio7Generator::EscapeForXML(const std::string& s)
 {
   return cmLocalVisualStudio7GeneratorEscapeForXML(s);
-- 
cgit v0.12


From b771b2c3001e2137293de4197a8567e5cd9f6466 Mon Sep 17 00:00:00 2001
From: Frank Goyens <frank.goyens@delem.com>
Date: Fri, 29 Jun 2018 15:41:41 +0200
Subject: VS: extended OutputDeploymentDebuggerTool for AdditionalFiles

The `OutputDeploymentDebuggerTool` function now also retrieves a target
property that is used for setting the `AdditionalFiles` attribute of
`DeploymentTool`.
---
 Source/cmLocalVisualStudio7Generator.cxx | 50 ++++++++++++++++++++------------
 1 file changed, 32 insertions(+), 18 deletions(-)

diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 2c1a95c..c90c5b8 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -1245,30 +1245,44 @@ static std::string cmLocalVisualStudio7GeneratorEscapeForXML(
   return ret;
 }
 
+static std::string GetEscapedPropertyIfValueNotNULL(const char* propertyValue)
+{
+  return propertyValue == nullptr
+    ? std::string()
+    : cmLocalVisualStudio7GeneratorEscapeForXML(propertyValue);
+}
+
 void cmLocalVisualStudio7Generator::OutputDeploymentDebuggerTool(
   std::ostream& fout, std::string const& config, cmGeneratorTarget* target)
 {
   if (this->WindowsCEProject) {
-    if (const char* dir = target->GetProperty("DEPLOYMENT_REMOTE_DIRECTORY")) {
-      /* clang-format off */
-      fout <<
-        "\t\t\t<DeploymentTool\n"
-        "\t\t\t\tForceDirty=\"-1\"\n"
-        "\t\t\t\tRemoteDirectory=\"" << this->EscapeForXML(dir) << "\"\n"
-        "\t\t\t\tRegisterOutput=\"0\"\n"
-        "\t\t\t\tAdditionalFiles=\"\"/>\n"
-        ;
-      /* clang-format on */
+    const char* dir = target->GetProperty("DEPLOYMENT_REMOTE_DIRECTORY");
+    const char* additionalFiles =
+      target->GetProperty("DEPLOYMENT_ADDITIONAL_FILES");
+
+    if (dir == nullptr && additionalFiles == nullptr) {
+      return;
+    }
+
+    fout << "\t\t\t<DeploymentTool\n"
+            "\t\t\t\tForceDirty=\"-1\"\n"
+            "\t\t\t\tRemoteDirectory=\""
+         << GetEscapedPropertyIfValueNotNULL(dir)
+         << "\"\n"
+            "\t\t\t\tRegisterOutput=\"0\"\n"
+            "\t\t\t\tAdditionalFiles=\""
+         << GetEscapedPropertyIfValueNotNULL(additionalFiles) << "\"/>\n";
+
+    if (dir != nullptr) {
       std::string const exe =
         dir + std::string("\\") + target->GetFullName(config);
-      /* clang-format off */
-      fout <<
-        "\t\t\t<DebuggerTool\n"
-        "\t\t\t\tRemoteExecutable=\"" << this->EscapeForXML(exe) << "\"\n"
-        "\t\t\t\tArguments=\"\"\n"
-        "\t\t\t/>\n"
-        ;
-      /* clang-format on */
+
+      fout << "\t\t\t<DebuggerTool\n"
+              "\t\t\t\tRemoteExecutable=\""
+           << this->EscapeForXML(exe)
+           << "\"\n"
+              "\t\t\t\tArguments=\"\"\n"
+              "\t\t\t/>\n";
     }
   }
 }
-- 
cgit v0.12


From 3b2ea092ef42f52434c9618023d3a7216bb43c98 Mon Sep 17 00:00:00 2001
From: Frank Goyens <frank.goyens@delem.com>
Date: Mon, 2 Jul 2018 10:35:26 +0200
Subject: Help: Add documentation for DEPLOYMENT_ADDITIONAL_FILES

---
 Help/manual/cmake-properties.7.rst            |  1 +
 Help/prop_tgt/DEPLOYMENT_ADDITIONAL_FILES.rst | 18 ++++++++++++++++++
 Help/release/dev/vs-deployment-files.rst      |  7 +++++++
 3 files changed, 26 insertions(+)
 create mode 100644 Help/prop_tgt/DEPLOYMENT_ADDITIONAL_FILES.rst
 create mode 100644 Help/release/dev/vs-deployment-files.rst

diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index 03a6a27..bebd591 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -173,6 +173,7 @@ Properties on Targets
    /prop_tgt/DEBUG_POSTFIX
    /prop_tgt/DEFINE_SYMBOL
    /prop_tgt/DEPLOYMENT_REMOTE_DIRECTORY
+   /prop_tgt/DEPLOYMENT_ADDITIONAL_FILES
    /prop_tgt/DOTNET_TARGET_FRAMEWORK_VERSION
    /prop_tgt/EchoString
    /prop_tgt/ENABLE_EXPORTS
diff --git a/Help/prop_tgt/DEPLOYMENT_ADDITIONAL_FILES.rst b/Help/prop_tgt/DEPLOYMENT_ADDITIONAL_FILES.rst
new file mode 100644
index 0000000..5e9c191
--- /dev/null
+++ b/Help/prop_tgt/DEPLOYMENT_ADDITIONAL_FILES.rst
@@ -0,0 +1,18 @@
+DEPLOYMENT_ADDITIONAL_FILES
+---------------------------
+
+Set the WinCE project ``AdditionalFiles`` in ``DeploymentTool`` in ``.vcproj``
+files generated by the :generator:`Visual Studio 9 2008` generator.
+This is useful when you want to debug on remote WinCE device.
+Specify additional files that will be copied to the device.
+For example:
+
+.. code-block:: cmake
+
+  set_property(TARGET ${TARGET} PROPERTY
+    DEPLOYMENT_ADDITIONAL_FILES "english.lng|local_folder|remote_folder|0"
+    "german.lng|local_folder|remote_folder|0")
+
+produces::
+
+  <DeploymentTool AdditionalFiles="english.lng|local_folder|remote_folder|0;german.lng|local_folder|remote_folder|0" ... />
diff --git a/Help/release/dev/vs-deployment-files.rst b/Help/release/dev/vs-deployment-files.rst
new file mode 100644
index 0000000..1590ed9
--- /dev/null
+++ b/Help/release/dev/vs-deployment-files.rst
@@ -0,0 +1,7 @@
+vs-deployment-files
+-------------------
+
+* The :prop_tgt:`DEPLOYMENT_ADDITIONAL_FILES` target property was
+  added to tell the :generator:`Visual Studio 9 2008` generator
+  to specify additional files for deployment to WinCE devices
+  for remote debugging.
-- 
cgit v0.12