[cmake-commits] hoffman committed cmLocalGenerator.cxx 1.188 1.189 cmLocalUnixMakefileGenerator3.cxx 1.192 1.193

cmake-commits at cmake.org cmake-commits at cmake.org
Wed Feb 28 14:29:28 EST 2007


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

Modified Files:
	cmLocalGenerator.cxx cmLocalUnixMakefileGenerator3.cxx 
Log Message:
ENH: one more pass at paths with spaces and parens


Index: cmLocalGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalGenerator.cxx,v
retrieving revision 1.188
retrieving revision 1.189
diff -u -d -r1.188 -r1.189
--- cmLocalGenerator.cxx	26 Feb 2007 16:56:13 -0000	1.188
+++ cmLocalGenerator.cxx	28 Feb 2007 19:29:26 -0000	1.189
@@ -2066,22 +2066,7 @@
     }
   if( output == SHELL)
     {
-    // for shell commands if force unix is on, but this->WindowsShell
-    // is true, then turn off force unix paths for the output path
-    // so that the path is windows style and will work with windows
-    // cmd.exe.
-    bool forceOn =  cmSystemTools::GetForceUnixPaths();
-    if(forceOn && this->WindowsShell)
-      {
-      cmSystemTools::SetForceUnixPaths(false);
-      }
-    result = cmSystemTools::ConvertToOutputPath(result.c_str());
-    if(forceOn && this->WindowsShell)
-      {
-      cmSystemTools::SetForceUnixPaths(true);
-      }
-
-    // For the MSYS shell convert drive letters to posix paths, so
+        // For the MSYS shell convert drive letters to posix paths, so
     // that c:/some/path becomes /c/some/path.  This is needed to
     // avoid problems with the shell path translation.
     if(this->MSYSShell)
@@ -2092,14 +2077,16 @@
         result[0] = '/';
         }
       }
-    // if this is unix then we need to escape () in the shell
-#if !defined(WIN32) || defined(CYGWIN)
-    forceOn = true;
-#endif
-    if(forceOn )
+    if(this->WindowsShell)
       {
-      result = cmSystemTools::EscapeForUnixShell(result);
+      std::string::size_type pos = 0;
+      while((pos = result.find('/', pos)) != std::string::npos)
+        {
+        result[pos] = '\\';
+        pos++;
+        }
       }
+    result = this->EscapeForShell(result.c_str(), true, false);
     }
   return result;
 }

Index: cmLocalUnixMakefileGenerator3.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalUnixMakefileGenerator3.cxx,v
retrieving revision 1.192
retrieving revision 1.193
diff -u -d -r1.192 -r1.193
--- cmLocalUnixMakefileGenerator3.cxx	28 Feb 2007 14:33:25 -0000	1.192
+++ cmLocalUnixMakefileGenerator3.cxx	28 Feb 2007 19:29:26 -0000	1.193
@@ -1776,14 +1776,15 @@
   if (tgt && tgt[0] != '\0')
     {
     std::string tgt2 = this->Convert(tgt,HOME_OUTPUT,MAKEFILE);
-    tgt2 = this->ConvertToMakeTarget(tgt2.c_str()); 
-    bool forceOn =  cmSystemTools::GetForceUnixPaths();
-#if !defined(WIN32) || defined(CYGWIN)
-    forceOn = true;
-#endif 
-    if(forceOn )
+    tgt2 = this->ConvertToMakeTarget(tgt2.c_str());
+    // for make -f foo bar, foo is a file but bar (tgt2) is 
+    // a make target.  make targets should be escaped with "" 
+    // and not \, so if we find a "\ " in the path then remove
+    // the \ and quote the whole string
+    if(tgt2.find("\\ ") != tgt2.npos)
       {
-      tgt2 = cmSystemTools::EscapeForUnixShell(tgt2);
+      cmSystemTools::ReplaceString(tgt2, "\\", "");
+      tgt2 = std::string("\"") + tgt2 + std::string("\"");
       }
     cmd += tgt2;
     }



More information about the Cmake-commits mailing list