[cmake-commits] king committed cmLocalVisualStudioGenerator.cxx 1.7 1.8

cmake-commits at cmake.org cmake-commits at cmake.org
Wed Oct 25 12:27:19 EDT 2006


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv1684

Modified Files:
	cmLocalVisualStudioGenerator.cxx 
Log Message:
BUG: Avoid leading and trailing newlines in custom command scripts because some VS6 versions do not like the trailing backslash this produces.  This addresses bug#3977.


Index: cmLocalVisualStudioGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalVisualStudioGenerator.cxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- cmLocalVisualStudioGenerator.cxx	27 Sep 2006 17:43:46 -0000	1.7
+++ cmLocalVisualStudioGenerator.cxx	25 Oct 2006 16:27:17 -0000	1.8
@@ -113,15 +113,19 @@
                   const char* workingDirectory,
                   bool escapeOldStyle,
                   bool escapeAllowMakeVars,
-                  const char* newline)
+                  const char* newline_text)
 {
+  // Avoid leading or trailing newlines.
+  const char* newline = "";
+
   // Store the script in a string.
   std::string script;
   if(workingDirectory)
     {
+    script += newline;
+    newline = newline_text;
     script += "cd ";
     script += this->Convert(workingDirectory, START_OUTPUT, SHELL);
-    script += newline;
     }
   // for visual studio IDE add extra stuff to the PATH
   // if CMAKE_MSVCIDE_RUN_PATH is set.
@@ -131,16 +135,21 @@
       this->Makefile->GetDefinition("CMAKE_MSVCIDE_RUN_PATH");
     if(extraPath)
       {
+      script += newline;
+      newline = newline_text;
       script += "set PATH=";
       script += extraPath;
       script += ";%PATH%";
-      script += newline;
       }
     }
   // Write each command on a single line.
   for(cmCustomCommandLines::const_iterator cl = commandLines.begin();
       cl != commandLines.end(); ++cl)
     {
+    // Start a new line.
+    script += newline;
+    newline = newline_text;
+
     // Start with the command name.
     const cmCustomCommandLine& commandLine = *cl;
     script += this->Convert(commandLine[0].c_str(),START_OUTPUT,SHELL);
@@ -159,9 +168,6 @@
                                        escapeAllowMakeVars);
         }
       }
-
-    // End the line.
-    script += newline;
     }
   return script;
 }



More information about the Cmake-commits mailing list