[Cmake-commits] CMake branch, next, updated. v3.7.0-rc1-142-g78a3604

Stephen Kelly steveire at gmail.com
Thu Oct 6 14:01:46 EDT 2016


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  78a3604d252b6f42d192807b9bac84f46e6ec76f (commit)
       via  d9718500fa01d3045ca86e85be68ab9dfee4cbed (commit)
      from  0d83b5464de903900cbe02e9bc484c30b37bca2b (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 -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=78a3604d252b6f42d192807b9bac84f46e6ec76f
commit 78a3604d252b6f42d192807b9bac84f46e6ec76f
Merge: 0d83b54 d971850
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Oct 6 14:01:44 2016 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Oct 6 14:01:44 2016 -0400

    Merge topic 'cleanup-Convert' into next
    
    d9718500 Revert "cmOutputConverter: Remove Convert..ForExisting method (#16138)"


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d9718500fa01d3045ca86e85be68ab9dfee4cbed
commit d9718500fa01d3045ca86e85be68ab9dfee4cbed
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Oct 6 20:00:51 2016 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Thu Oct 6 20:00:51 2016 +0200

    Revert "cmOutputConverter: Remove Convert..ForExisting method (#16138)"
    
    This reverts commit 0fb47ff836af7fbd74998bfeb3067708b9f7db68.

diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 8fcfb32..b2569a2 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -731,8 +731,7 @@ std::string cmLocalGenerator::ExpandRuleVariable(
         std::string replace = this->Makefile->GetSafeDefinition(variable);
         // if the variable is not a FLAG then treat it like a path
         if (variable.find("_FLAG") == variable.npos) {
-          std::string ret =
-            this->ConvertToOutputFormat(replace, cmOutputConverter::SHELL);
+          std::string ret = this->ConvertToOutputForExisting(replace);
           // if there is a required first argument to the compiler add it
           // to the compiler string
           if (compilerArg1) {
@@ -829,7 +828,7 @@ std::string cmLocalGenerator::ConvertToIncludeReference(
   std::string const& path, OutputFormat format, bool forceFullPaths)
 {
   static_cast<void>(forceFullPaths);
-  return this->ConvertToOutputFormat(path, format);
+  return this->ConvertToOutputForExisting(path, format);
 }
 
 std::string cmLocalGenerator::GetIncludeFlags(
@@ -1497,7 +1496,8 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries,
   std::vector<std::string> const& libDirs = cli.GetDirectories();
   for (std::vector<std::string>::const_iterator libDir = libDirs.begin();
        libDir != libDirs.end(); ++libDir) {
-    std::string libpath = this->ConvertToOutputFormat(*libDir, shellFormat);
+    std::string libpath =
+      this->ConvertToOutputForExisting(*libDir, shellFormat);
     linkPath += " " + libPathFlag;
     linkPath += libpath;
     linkPath += libPathTerminator;
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 401319e..915119c 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -2081,19 +2081,18 @@ void cmLocalUnixMakefileGenerator3::CreateCDCommand(
     // back because the shell keeps the working directory between
     // commands.
     std::string cmd = cd_cmd;
-    cmd += this->ConvertToOutputFormat(tgtDir, cmOutputConverter::SHELL);
+    cmd += this->ConvertToOutputForExisting(tgtDir);
     commands.insert(commands.begin(), cmd);
 
     // Change back to the starting directory.
     cmd = cd_cmd;
-    cmd += this->ConvertToOutputFormat(relDir, cmOutputConverter::SHELL);
+    cmd += this->ConvertToOutputForExisting(relDir);
     commands.push_back(cmd);
   } else {
     // On UNIX we must construct a single shell command to change
     // directory and build because make resets the directory between
     // each command.
-    std::string outputForExisting =
-      this->ConvertToOutputFormat(tgtDir, cmOutputConverter::SHELL);
+    std::string outputForExisting = this->ConvertToOutputForExisting(tgtDir);
     std::string prefix = cd_cmd + outputForExisting + " && ";
     std::transform(commands.begin(), commands.end(), commands.begin(),
                    std::bind1st(std::plus<std::string>(), prefix));
diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx
index 05e7d63..84a433c 100644
--- a/Source/cmOutputConverter.cxx
+++ b/Source/cmOutputConverter.cxx
@@ -18,6 +18,25 @@ cmOutputConverter::cmOutputConverter(cmState::Snapshot snapshot)
   assert(this->StateSnapshot.IsValid());
 }
 
+std::string cmOutputConverter::ConvertToOutputForExisting(
+  const std::string& remote, OutputFormat format) const
+{
+  // If this is a windows shell, the result has a space, and the path
+  // already exists, we can use a short-path to reference it without a
+  // space.
+  if (this->GetState()->UseWindowsShell() &&
+      remote.find(' ') != std::string::npos &&
+      cmSystemTools::FileExists(remote.c_str())) {
+    std::string tmp;
+    if (cmSystemTools::GetShortPath(remote, tmp)) {
+      return this->ConvertToOutputFormat(tmp, format);
+    }
+  }
+
+  // Otherwise, perform standard conversion.
+  return this->ConvertToOutputFormat(remote, format);
+}
+
 std::string cmOutputConverter::ConvertToOutputFormat(const std::string& source,
                                                      OutputFormat output) const
 {
diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h
index f8bdcea..71cacab 100644
--- a/Source/cmOutputConverter.h
+++ b/Source/cmOutputConverter.h
@@ -26,6 +26,10 @@ public:
   std::string ConvertDirectorySeparatorsForShell(
     const std::string& source) const;
 
+  ///! for existing files convert to output path and short path if spaces
+  std::string ConvertToOutputForExisting(const std::string& remote,
+                                         OutputFormat format = SHELL) const;
+
   void SetLinkScriptShell(bool linkScriptShell);
 
   /**

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

Summary of changes:
 Source/cmLocalGenerator.cxx              |    8 ++++----
 Source/cmLocalUnixMakefileGenerator3.cxx |    7 +++----
 Source/cmOutputConverter.cxx             |   19 +++++++++++++++++++
 Source/cmOutputConverter.h               |    4 ++++
 4 files changed, 30 insertions(+), 8 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list