[Cmake-commits] CMake branch, next, updated. v2.8.2-992-g9965fe7

Brad King brad.king at kitware.com
Mon Oct 4 09:26:33 EDT 2010


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  9965fe715c471413b6a721203b9f99d7124830a5 (commit)
       via  2596e16c8f241b52add4d54108fd5df4269cb2fc (commit)
      from  5f97704a7a4eef48e7386a59d0db846324c03f67 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9965fe715c471413b6a721203b9f99d7124830a5
commit 9965fe715c471413b6a721203b9f99d7124830a5
Merge: 5f97704 2596e16
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Oct 4 09:26:32 2010 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Mon Oct 4 09:26:32 2010 -0400

    Merge topic 'vs10-custom-comments' into next
    
    2596e16 VS10: Encode custom command comments for echo (#11283)


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2596e16c8f241b52add4d54108fd5df4269cb2fc
commit 2596e16c8f241b52add4d54108fd5df4269cb2fc
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Oct 1 16:12:00 2010 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Oct 1 16:12:00 2010 -0400

    VS10: Encode custom command comments for echo (#11283)
    
    VS10 uses MSBuild underneath.  The <Message></Message> CDATA are just
    appended to "echo" and executed as a single command.  Encode the message
    such that it can be passed to echo.  Convert newlines to tabs since they
    cannot be printed this way.

diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 8dfafff..642ae94 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -32,6 +32,30 @@ static std::string cmVS10EscapeXML(std::string arg)
   return arg;
 }
 
+static std::string cmVS10EscapeComment(std::string comment)
+{
+  // MSBuild takes the CDATA of a <Message></Message> element and just
+  // does "echo $CDATA" with no escapes.  We must encode the string.
+  // http://technet.microsoft.com/en-us/library/cc772462%28WS.10%29.aspx
+  std::string echoable;
+  for(std::string::iterator c = comment.begin(); c != comment.end(); ++c)
+    {
+    switch (*c)
+      {
+      case '\r': break;
+      case '\n': echoable += '\t'; break;
+      case '"': /* no break */
+      case '|': /* no break */
+      case '&': /* no break */
+      case '<': /* no break */
+      case '>': /* no break */
+      case '^': echoable += '^'; /* no break */
+      default:  echoable += *c; break;
+      }
+    }
+  return echoable;
+}
+
 cmVisualStudio10TargetGenerator::
 cmVisualStudio10TargetGenerator(cmTarget* target,
                                 cmGlobalVisualStudio10Generator* gg)
@@ -325,6 +349,7 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source,
     }
   cmLocalVisualStudio7Generator* lg = this->LocalGenerator;
   std::string comment = lg->ConstructComment(command);
+  comment = cmVS10EscapeComment(comment);
   std::vector<std::string> *configs =
     static_cast<cmGlobalVisualStudio7Generator *>
     (this->GlobalGenerator)->GetConfigurations(); 
@@ -347,7 +372,7 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source,
                             command.GetEscapeAllowMakeVars())
         );
     this->WritePlatformConfigTag("Message",i->c_str(), 3);
-    (*this->BuildFileStream ) << comment << "</Message>\n";
+    (*this->BuildFileStream ) << cmVS10EscapeXML(comment) << "</Message>\n";
     this->WritePlatformConfigTag("Command", i->c_str(), 3);
     (*this->BuildFileStream ) << script << "</Command>\n";
     this->WritePlatformConfigTag("AdditionalInputs", i->c_str(), 3);
@@ -1433,8 +1458,9 @@ void cmVisualStudio10TargetGenerator::WriteEvent(
                             command.GetEscapeAllowMakeVars())
         );
     }
+  comment = cmVS10EscapeComment(comment);
   this->WriteString("<Message>",3);
-  (*this->BuildFileStream ) << comment << "</Message>\n";
+  (*this->BuildFileStream ) << cmVS10EscapeXML(comment) << "</Message>\n";
   this->WriteString("<Command>", 3);
   (*this->BuildFileStream ) << script;
   (*this->BuildFileStream ) << "</Command>" << "\n";

-----------------------------------------------------------------------

Summary of changes:
 Source/cmVisualStudio10TargetGenerator.cxx |   30 ++++++++++++++++++++++++++-
 1 files changed, 28 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list