[Cmake-commits] CMake branch, next, updated. v3.7.0-rc1-71-geff4fa9

Brad King brad.king at kitware.com
Wed Oct 5 09:33:17 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  eff4fa9738cfaaf5fe7d7cdd3d4983bf0cfbee10 (commit)
       via  d7806c45a0bf7e765cb76229fa5f8be47c10701b (commit)
      from  ca4f6938620160242f24f612a5495d40bf5cf933 (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=eff4fa9738cfaaf5fe7d7cdd3d4983bf0cfbee10
commit eff4fa9738cfaaf5fe7d7cdd3d4983bf0cfbee10
Merge: ca4f693 d7806c4
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Oct 5 09:33:16 2016 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Oct 5 09:33:16 2016 -0400

    Merge topic 'extract-cmLinkLineComputer' into next
    
    d7806c45 Revert topic 'extract-cmLinkLineComputer'


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d7806c45a0bf7e765cb76229fa5f8be47c10701b
commit d7806c45a0bf7e765cb76229fa5f8be47c10701b
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Oct 5 09:31:41 2016 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Oct 5 09:31:41 2016 -0400

    Revert topic 'extract-cmLinkLineComputer'
    
    It needs revisions to build everywhere.

diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 81108ad..ec49481 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -300,8 +300,6 @@ set(SRCS
   cmInstallDirectoryGenerator.cxx
   cmLinkedTree.h
   cmLinkItem.h
-  cmLinkLineComputer.cxx
-  cmLinkLineComputer.h
   cmListFileCache.cxx
   cmListFileCache.h
   cmListFileLexer.c
@@ -320,8 +318,6 @@ set(SRCS
   cmMakefileUtilityTargetGenerator.cxx
   cmMessenger.cxx
   cmMessenger.h
-  cmMSVC60LinkLineComputer.cxx
-  cmMSVC60LinkLineComputer.h
   cmOSXBundleGenerator.cxx
   cmOSXBundleGenerator.h
   cmOutputConverter.cxx
@@ -547,8 +543,6 @@ set(SRCS ${SRCS}
   cmNinjaNormalTargetGenerator.h
   cmNinjaUtilityTargetGenerator.cxx
   cmNinjaUtilityTargetGenerator.h
-  cmNinjaLinkLineComputer.cxx
-  cmNinjaLinkLineComputer.h
   )
 
 # Temporary variable for tools targets
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index b995fa1..6887a31 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -12,7 +12,6 @@
 #include "cmComputeLinkInformation.h"
 #include "cmGeneratorTarget.h"
 #include "cmGlobalCommonGenerator.h"
-#include "cmLinkLineComputer.h"
 #include "cmLocalCommonGenerator.h"
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
@@ -60,8 +59,7 @@ void cmCommonTargetGenerator::AddFeatureFlags(std::string& flags,
   }
 }
 
-void cmCommonTargetGenerator::AddModuleDefinitionFlag(
-  cmLinkLineComputer* linkLineComputer, std::string& flags)
+void cmCommonTargetGenerator::AddModuleDefinitionFlag(std::string& flags)
 {
   if (!this->ModuleDefinitionFile) {
     return;
@@ -77,10 +75,8 @@ void cmCommonTargetGenerator::AddModuleDefinitionFlag(
   // Append the flag and value.  Use ConvertToLinkReference to help
   // vs6's "cl -link" pass it to the linker.
   std::string flag = defFileFlag;
-  flag += this->LocalGenerator->ConvertToOutputFormat(
-    linkLineComputer->ConvertToLinkReference(
-      this->ModuleDefinitionFile->GetFullPath()),
-    cmOutputConverter::SHELL);
+  flag += (this->LocalGenerator->ConvertToLinkReference(
+    this->ModuleDefinitionFile->GetFullPath()));
   this->LocalGenerator->AppendFlags(flags, flag);
 }
 
diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h
index fe27038..707b81e 100644
--- a/Source/cmCommonTargetGenerator.h
+++ b/Source/cmCommonTargetGenerator.h
@@ -16,7 +16,6 @@ class cmGlobalCommonGenerator;
 class cmLocalCommonGenerator;
 class cmMakefile;
 class cmSourceFile;
-class cmLinkLineComputer;
 
 /** \class cmCommonTargetGenerator
  * \brief Common infrastructure for Makefile and Ninja per-target generators
@@ -38,8 +37,7 @@ protected:
   bool GetFeatureAsBool(const std::string& feature);
 
   // Helper to add flag for windows .def file.
-  void AddModuleDefinitionFlag(cmLinkLineComputer* linkLineComputer,
-                               std::string& flags);
+  void AddModuleDefinitionFlag(std::string& flags);
 
   cmGeneratorTarget* GeneratorTarget;
   cmMakefile* Makefile;
diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx
index aaa9d3a..c1c8880 100644
--- a/Source/cmDependsFortran.cxx
+++ b/Source/cmDependsFortran.cxx
@@ -198,13 +198,16 @@ bool cmDependsFortran::Finalize(std::ostream& makeDepends,
       stamp += ".mod.stamp";
       fcStream << "\n";
       fcStream << "  \""
-               << this->MaybeConvertToRelativePath(currentBinDir, mod_lower)
+               << this->LocalGenerator->ConvertToRelativePath(currentBinDir,
+                                                              mod_lower)
                << "\"\n";
       fcStream << "  \""
-               << this->MaybeConvertToRelativePath(currentBinDir, mod_upper)
+               << this->LocalGenerator->ConvertToRelativePath(currentBinDir,
+                                                              mod_upper)
                << "\"\n";
       fcStream << "  \""
-               << this->MaybeConvertToRelativePath(currentBinDir, stamp)
+               << this->LocalGenerator->ConvertToRelativePath(currentBinDir,
+                                                              stamp)
                << "\"\n";
     }
     fcStream << "  )\n";
@@ -320,16 +323,17 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj,
 
   // Write the include dependencies to the output stream.
   std::string binDir = this->LocalGenerator->GetBinaryDirectory();
-  std::string obj_i = this->MaybeConvertToRelativePath(binDir, obj);
+  std::string obj_i = this->LocalGenerator->ConvertToRelativePath(binDir, obj);
   std::string obj_m = cmSystemTools::ConvertToOutputPath(obj_i.c_str());
   internalDepends << obj_i << std::endl;
   internalDepends << " " << src << std::endl;
   for (std::set<std::string>::const_iterator i = info.Includes.begin();
        i != info.Includes.end(); ++i) {
-    makeDepends << obj_m << ": "
-                << cmSystemTools::ConvertToOutputPath(
-                     this->MaybeConvertToRelativePath(binDir, *i).c_str())
-                << std::endl;
+    makeDepends
+      << obj_m << ": "
+      << cmSystemTools::ConvertToOutputPath(
+           this->LocalGenerator->ConvertToRelativePath(binDir, *i).c_str())
+      << std::endl;
     internalDepends << " " << *i << std::endl;
   }
   makeDepends << std::endl;
@@ -355,7 +359,7 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj,
       proxy += *i;
       proxy += ".mod.proxy";
       proxy = cmSystemTools::ConvertToOutputPath(
-        this->MaybeConvertToRelativePath(binDir, proxy).c_str());
+        this->LocalGenerator->ConvertToRelativePath(binDir, proxy).c_str());
 
       // since we require some things add them to our list of requirements
       makeDepends << obj_m << ".requires: " << proxy << std::endl;
@@ -371,7 +375,8 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj,
     if (!required->second.empty()) {
       // This module is known.  Depend on its timestamp file.
       std::string stampFile = cmSystemTools::ConvertToOutputPath(
-        this->MaybeConvertToRelativePath(binDir, required->second).c_str());
+        this->LocalGenerator->ConvertToRelativePath(binDir, required->second)
+          .c_str());
       makeDepends << obj_m << ": " << stampFile << "\n";
     } else {
       // This module is not known to CMake.  Try to locate it where
@@ -379,7 +384,7 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj,
       std::string module;
       if (this->FindModule(*i, module)) {
         module = cmSystemTools::ConvertToOutputPath(
-          this->MaybeConvertToRelativePath(binDir, module).c_str());
+          this->LocalGenerator->ConvertToRelativePath(binDir, module).c_str());
         makeDepends << obj_m << ": " << module << "\n";
       }
     }
@@ -393,7 +398,7 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj,
     proxy += *i;
     proxy += ".mod.proxy";
     proxy = cmSystemTools::ConvertToOutputPath(
-      this->MaybeConvertToRelativePath(binDir, proxy).c_str());
+      this->LocalGenerator->ConvertToRelativePath(binDir, proxy).c_str());
     makeDepends << proxy << ": " << obj_m << ".provides" << std::endl;
   }
 
@@ -415,14 +420,14 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj,
       modFile += "/";
       modFile += *i;
       modFile = this->LocalGenerator->ConvertToOutputFormat(
-        this->MaybeConvertToRelativePath(binDir, modFile),
+        this->LocalGenerator->ConvertToRelativePath(binDir, modFile),
         cmOutputConverter::SHELL);
       std::string stampFile = stamp_dir;
       stampFile += "/";
       stampFile += m;
       stampFile += ".mod.stamp";
       stampFile = this->LocalGenerator->ConvertToOutputFormat(
-        this->MaybeConvertToRelativePath(binDir, stampFile),
+        this->LocalGenerator->ConvertToRelativePath(binDir, stampFile),
         cmOutputConverter::SHELL);
       makeDepends << "\t$(CMAKE_COMMAND) -E cmake_copy_f90_mod " << modFile
                   << " " << stampFile;
@@ -443,7 +448,7 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj,
     std::string driver = this->TargetDirectory;
     driver += "/build";
     driver = cmSystemTools::ConvertToOutputPath(
-      this->MaybeConvertToRelativePath(binDir, driver).c_str());
+      this->LocalGenerator->ConvertToRelativePath(binDir, driver).c_str());
     makeDepends << driver << ": " << obj_m << ".provides.build\n";
   }
 
@@ -703,13 +708,3 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile,
   // content.
   return cmFortranStreamsDiffer(finModFile, finStampFile);
 }
-
-std::string cmDependsFortran::MaybeConvertToRelativePath(
-  std::string const& base, std::string const& path)
-{
-  if (!cmOutputConverter::ContainedInDirectory(
-        base, path, this->LocalGenerator->GetStateSnapshot().GetDirectory())) {
-    return path;
-  }
-  return cmOutputConverter::ForceToRelativePath(base, path);
-}
diff --git a/Source/cmDependsFortran.h b/Source/cmDependsFortran.h
index 90b82d4..8d347f4 100644
--- a/Source/cmDependsFortran.h
+++ b/Source/cmDependsFortran.h
@@ -78,9 +78,6 @@ protected:
 private:
   cmDependsFortran(cmDependsFortran const&); // Purposely not implemented.
   void operator=(cmDependsFortran const&);   // Purposely not implemented.
-
-  std::string MaybeConvertToRelativePath(std::string const& base,
-                                         std::string const& path);
 };
 
 #endif
diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx
index 9e43a52..959dfdb 100644
--- a/Source/cmGhsMultiTargetGenerator.cxx
+++ b/Source/cmGhsMultiTargetGenerator.cxx
@@ -362,13 +362,9 @@ void cmGhsMultiTargetGenerator::WriteTargetLinkLibraries(
       this->GeneratorTarget->GetCreateRuleVariable(language, config);
     bool useWatcomQuote =
       this->Makefile->IsOn(createRule + "_USE_WATCOM_QUOTE");
-    CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer =
-      this->GetGlobalGenerator()->CreateLinkLineComputer(
-        this->LocalGenerator->GetStateSnapshot().GetDirectory());
-
     this->LocalGenerator->GetTargetFlags(
-      linkLineComputer.get(), config, linkLibraries, flags, linkFlags,
-      frameworkPath, linkPath, this->GeneratorTarget, useWatcomQuote);
+      config, linkLibraries, flags, linkFlags, frameworkPath, linkPath,
+      this->GeneratorTarget, useWatcomQuote);
     linkFlags = cmSystemTools::TrimWhitespace(linkFlags);
 
     if (!linkPath.empty()) {
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 251555b..a446862 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -20,9 +20,7 @@
 #include "cmGeneratorExpression.h"
 #include "cmGeneratorTarget.h"
 #include "cmInstallGenerator.h"
-#include "cmLinkLineComputer.h"
 #include "cmLocalGenerator.h"
-#include "cmMSVC60LinkLineComputer.h"
 #include "cmMakefile.h"
 #include "cmOutputConverter.h"
 #include "cmPolicies.h"
@@ -1395,18 +1393,6 @@ cmGlobalGenerator::CreateQtAutoGeneratorsTargets()
   return autogenTargets;
 }
 
-cmLinkLineComputer* cmGlobalGenerator::CreateLinkLineComputer(
-  cmState::Directory stateDir) const
-{
-  return new cmLinkLineComputer(stateDir);
-}
-
-cmLinkLineComputer* cmGlobalGenerator::CreateMSVC60LinkLineComputer(
-  cmState::Directory stateDir) const
-{
-  return new cmMSVC60LinkLineComputer(stateDir);
-}
-
 void cmGlobalGenerator::FinalizeTargetCompileInfo()
 {
   std::vector<std::string> const langs =
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 3ae2ebd..4120b52 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -33,7 +33,6 @@ class cmExportBuildFileGenerator;
 class cmExternalMakefileProjectGenerator;
 class cmGeneratorTarget;
 class cmLocalGenerator;
-class cmLinkLineComputer;
 class cmMakefile;
 class cmake;
 
@@ -99,12 +98,6 @@ public:
    */
   virtual void Generate();
 
-  virtual cmLinkLineComputer* CreateLinkLineComputer(
-    cmState::Directory stateDir) const;
-
-  cmLinkLineComputer* CreateMSVC60LinkLineComputer(
-    cmState::Directory stateDir) const;
-
   /**
    * Set/Get and Clear the enabled languages.
    */
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 9e0c5b6..f5a0e68 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -11,7 +11,6 @@
 #include "cmLocalGenerator.h"
 #include "cmLocalNinjaGenerator.h"
 #include "cmMakefile.h"
-#include "cmNinjaLinkLineComputer.h"
 #include "cmOutputConverter.h"
 #include "cmState.h"
 #include "cmSystemTools.h"
@@ -65,12 +64,6 @@ void cmGlobalNinjaGenerator::WriteComment(std::ostream& os,
   os << "# " << comment.substr(lpos) << "\n\n";
 }
 
-cmLinkLineComputer* cmGlobalNinjaGenerator::CreateLinkLineComputer(
-  cmState::Directory stateDir) const
-{
-  return new cmNinjaLinkLineComputer(stateDir, this->OutputPathPrefix);
-}
-
 std::string cmGlobalNinjaGenerator::EncodeRuleName(std::string const& name)
 {
   // Ninja rule names must match "[a-zA-Z0-9_.-]+".  Use ".xx" to encode
@@ -837,37 +830,19 @@ static void EnsureTrailingSlash(std::string& path)
 #endif
 }
 
-std::string cmGlobalNinjaGenerator::ConvertToNinjaPath(
-  const std::string& path, cmState::Directory stateDir,
-  std::string const& prefix)
+std::string cmGlobalNinjaGenerator::ConvertToNinjaPath(const std::string& path)
 {
-  std::string convPath = path;
-
-  if (cmOutputConverter::ContainedInDirectory(stateDir.GetCurrentBinary(),
-                                              path, stateDir)) {
-    convPath = cmOutputConverter::ForceToRelativePath(
-      stateDir.GetCurrentBinary(), path);
-  }
-
-  if (!cmSystemTools::FileIsFullPath(convPath)) {
-    convPath = prefix + convPath;
-  }
-
+  cmLocalNinjaGenerator* ng =
+    static_cast<cmLocalNinjaGenerator*>(this->LocalGenerators[0]);
+  std::string convPath = ng->ConvertToRelativePath(
+    this->LocalGenerators[0]->GetState()->GetBinaryDirectory(), path);
+  convPath = this->NinjaOutputPath(convPath);
 #ifdef _WIN32
   std::replace(convPath.begin(), convPath.end(), '/', '\\');
 #endif
   return convPath;
 }
 
-std::string cmGlobalNinjaGenerator::ConvertToNinjaPath(const std::string& path)
-{
-  cmLocalNinjaGenerator* ng =
-    static_cast<cmLocalNinjaGenerator*>(this->LocalGenerators[0]);
-
-  return ConvertToNinjaPath(path, ng->GetStateSnapshot().GetDirectory(),
-                            this->OutputPathPrefix);
-}
-
 std::string cmGlobalNinjaGenerator::ConvertToNinjaFolderRule(
   const std::string& path)
 {
@@ -1448,7 +1423,7 @@ void cmGlobalNinjaGenerator::InitOutputPathPrefix()
 
 std::string cmGlobalNinjaGenerator::NinjaOutputPath(std::string const& path)
 {
-  if (cmSystemTools::FileIsFullPath(path)) {
+  if (!this->HasOutputPathPrefix() || cmSystemTools::FileIsFullPath(path)) {
     return path;
   }
   return this->OutputPathPrefix + path;
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index c0e0dff..dcf7406 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -70,9 +70,6 @@ public:
   std::string EncodePath(const std::string& path);
   static std::string EncodeDepfileSpace(const std::string& path);
 
-  cmLinkLineComputer* CreateLinkLineComputer(cmState::Directory stateDir) const
-    CM_OVERRIDE;
-
   /**
    * Write the given @a comment to the output stream @a os. It
    * handles new line character properly.
@@ -236,9 +233,6 @@ public:
     return this->RulesFileStream;
   }
 
-  static std::string ConvertToNinjaPath(const std::string& path,
-                                        cmState::Directory stateDir,
-                                        std::string const& prefix);
   std::string ConvertToNinjaPath(const std::string& path);
   std::string ConvertToNinjaFolderRule(const std::string& path);
 
@@ -340,7 +334,6 @@ public:
   bool SupportsImplicitOuts() const;
 
   std::string NinjaOutputPath(std::string const& path);
-  std::string GetOutputPathPrefix() const { return this->OutputPathPrefix; }
   bool HasOutputPathPrefix() const { return !this->OutputPathPrefix.empty(); }
   void StripNinjaOutputPathPrefixAsSuffix(std::string& path);
 
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 95f6ea8..4a5cc77 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -306,12 +306,16 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
   // reset lg to the first makefile
   lg = static_cast<cmLocalUnixMakefileGenerator3*>(this->LocalGenerators[0]);
 
+  // Build the path to the cache file.
+  std::string cache = this->GetCMakeInstance()->GetHomeOutputDirectory();
+  cache += "/CMakeCache.txt";
+
   std::string currentBinDir = lg->GetCurrentBinaryDirectory();
   // Save the list to the cmake file.
   cmakefileStream
     << "# The top level Makefile was generated from the following files:\n"
     << "set(CMAKE_MAKEFILE_DEPENDS\n"
-    << "  \"CMakeCache.txt\"\n";
+    << "  \"" << lg->ConvertToRelativePath(currentBinDir, cache) << "\"\n";
   for (std::vector<std::string>::const_iterator i = lfiles.begin();
        i != lfiles.end(); ++i) {
     cmakefileStream << "  \"" << lg->ConvertToRelativePath(currentBinDir, *i)
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 75fc2e4..4ff612d 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -3325,14 +3325,14 @@ std::string cmGlobalXCodeGenerator::RelativeToSource(const char* p)
 {
   // We force conversion because Xcode breakpoints do not work unless
   // they are in a file named relative to the source tree.
-  return cmOutputConverter::ForceToRelativePath(
-    cmSystemTools::JoinPath(this->ProjectSourceDirectoryComponents), p);
+  return this->CurrentLocalGenerator->ConvertToRelativePath(
+    this->ProjectSourceDirectoryComponents, p, true);
 }
 
 std::string cmGlobalXCodeGenerator::RelativeToBinary(const char* p)
 {
   return this->CurrentLocalGenerator->ConvertToRelativePath(
-    cmSystemTools::JoinPath(this->ProjectOutputDirectoryComponents), p);
+    this->ProjectOutputDirectoryComponents, p);
 }
 
 std::string cmGlobalXCodeGenerator::XCodeEscapePath(const std::string& p)
diff --git a/Source/cmLinkLineComputer.cxx b/Source/cmLinkLineComputer.cxx
deleted file mode 100644
index 7103a5b..0000000
--- a/Source/cmLinkLineComputer.cxx
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
-   file Copyright.txt or https://cmake.org/licensing for details.  */
-
-#include "cmLinkLineComputer.h"
-#include "cmOutputConverter.h"
-
-cmLinkLineComputer::cmLinkLineComputer(cmState::Directory stateDir)
-  : StateDir(stateDir)
-{
-}
-
-cmLinkLineComputer::~cmLinkLineComputer()
-{
-}
-
-std::string cmLinkLineComputer::ConvertToLinkReference(
-  std::string const& lib) const
-{
-  std::string relLib = lib;
-
-  if (cmOutputConverter::ContainedInDirectory(
-        this->StateDir.GetCurrentBinary(), lib, this->StateDir)) {
-    relLib = cmOutputConverter::ForceToRelativePath(
-      this->StateDir.GetCurrentBinary(), lib);
-  }
-  return relLib;
-}
diff --git a/Source/cmLinkLineComputer.h b/Source/cmLinkLineComputer.h
deleted file mode 100644
index b25cbf9..0000000
--- a/Source/cmLinkLineComputer.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
-   file Copyright.txt or https://cmake.org/licensing for details.  */
-
-#ifndef cmLinkLineComputer_h
-#define cmLinkLineComputer_h
-
-#include "cmState.h"
-
-class cmLinkLineComputer
-{
-public:
-  cmLinkLineComputer(cmState::Directory stateDir);
-  virtual ~cmLinkLineComputer();
-
-  virtual std::string ConvertToLinkReference(std::string const& input) const;
-
-protected:
-  cmState::Directory StateDir;
-};
-
-#endif
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 7db0282..f24b717 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -12,7 +12,6 @@
 #include "cmInstallGenerator.h"
 #include "cmInstallScriptGenerator.h"
 #include "cmInstallTargetGenerator.h"
-#include "cmLinkLineComputer.h"
 #include "cmMakefile.h"
 #include "cmSourceFile.h"
 #include "cmSystemTools.h"
@@ -732,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) {
@@ -830,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(
@@ -1150,10 +1148,9 @@ void cmLocalGenerator::GetStaticLibraryFlags(std::string& flags,
 }
 
 void cmLocalGenerator::GetTargetFlags(
-  cmLinkLineComputer* linkLineComputer, const std::string& config,
-  std::string& linkLibs, std::string& flags, std::string& linkFlags,
-  std::string& frameworkPath, std::string& linkPath, cmGeneratorTarget* target,
-  bool useWatcomQuote)
+  const std::string& config, std::string& linkLibs, std::string& flags,
+  std::string& linkFlags, std::string& frameworkPath, std::string& linkPath,
+  cmGeneratorTarget* target, bool useWatcomQuote)
 {
   const std::string buildType = cmSystemTools::UpperCase(config);
   const char* libraryLinkVariable =
@@ -1205,9 +1202,8 @@ void cmLocalGenerator::GetTargetFlags(
           linkFlags += " ";
         }
       }
-      this->OutputLinkLibraries(linkLineComputer, linkLibs, frameworkPath,
-                                linkPath, *target, false, false,
-                                useWatcomQuote);
+      this->OutputLinkLibraries(linkLibs, frameworkPath, linkPath, *target,
+                                false, false, useWatcomQuote);
     } break;
     case cmState::EXECUTABLE: {
       linkFlags += this->Makefile->GetSafeDefinition("CMAKE_EXE_LINKER_FLAGS");
@@ -1226,9 +1222,8 @@ void cmLocalGenerator::GetTargetFlags(
         return;
       }
       this->AddLanguageFlags(flags, linkLanguage, buildType);
-      this->OutputLinkLibraries(linkLineComputer, linkLibs, frameworkPath,
-                                linkPath, *target, false, false,
-                                useWatcomQuote);
+      this->OutputLinkLibraries(linkLibs, frameworkPath, linkPath, *target,
+                                false, false, useWatcomQuote);
       if (cmSystemTools::IsOn(
             this->Makefile->GetDefinition("BUILD_SHARED_LIBS"))) {
         std::string sFlagVar = std::string("CMAKE_SHARED_BUILD_") +
@@ -1379,15 +1374,48 @@ std::string cmLocalGenerator::GetTargetFortranFlags(
   return std::string();
 }
 
+std::string cmLocalGenerator::ConvertToLinkReference(std::string const& lib,
+                                                     OutputFormat format)
+{
+#if defined(_WIN32) && !defined(__CYGWIN__)
+  // Work-ardound command line parsing limitations in MSVC 6.0
+  if (this->Makefile->IsOn("MSVC60")) {
+    // Search for the last space.
+    std::string::size_type pos = lib.rfind(' ');
+    if (pos != lib.npos) {
+      // Find the slash after the last space, if any.
+      pos = lib.find('/', pos);
+
+      // Convert the portion of the path with a space to a short path.
+      std::string sp;
+      if (cmSystemTools::GetShortPath(lib.substr(0, pos).c_str(), sp)) {
+        // Append the rest of the path with no space.
+        sp += lib.substr(pos);
+
+        // Convert to an output path.
+        return this->ConvertToOutputFormat(sp.c_str(), format);
+      }
+    }
+  }
+#endif
+
+  // Normal behavior.
+  return this->ConvertToOutputFormat(
+    this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), lib),
+    format);
+}
+
 /**
  * Output the linking rules on a command line.  For executables,
  * targetLibrary should be a NULL pointer.  For libraries, it should point
  * to the name of the library.  This will not link a library against itself.
  */
-void cmLocalGenerator::OutputLinkLibraries(
-  cmLinkLineComputer* linkLineComputer, std::string& linkLibraries,
-  std::string& frameworkPath, std::string& linkPath, cmGeneratorTarget& tgt,
-  bool relink, bool forResponseFile, bool useWatcomQuote)
+void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries,
+                                           std::string& frameworkPath,
+                                           std::string& linkPath,
+                                           cmGeneratorTarget& tgt, bool relink,
+                                           bool forResponseFile,
+                                           bool useWatcomQuote)
 {
   OutputFormat shellFormat =
     (forResponseFile) ? RESPONSE : ((useWatcomQuote) ? WATCOMQUOTE : SHELL);
@@ -1472,7 +1500,8 @@ void cmLocalGenerator::OutputLinkLibraries(
   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;
@@ -1488,8 +1517,7 @@ void cmLocalGenerator::OutputLinkLibraries(
       continue;
     }
     if (li->IsPath) {
-      linkLibs += this->ConvertToOutputFormat(
-        linkLineComputer->ConvertToLinkReference(li->Value), shellFormat);
+      linkLibs += this->ConvertToLinkReference(li->Value, shellFormat);
     } else {
       linkLibs += li->Value;
     }
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 1b49dd1..19469be 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -24,7 +24,6 @@ class cmGeneratorTarget;
 class cmGlobalGenerator;
 class cmMakefile;
 class cmSourceFile;
-class cmLinkLineComputer;
 
 /** \class cmLocalGenerator
  * \brief Create required build files for a directory.
@@ -310,8 +309,7 @@ public:
 
   /** Fill out these strings for the given target.  Libraries to link,
    *  flags, and linkflags. */
-  void GetTargetFlags(cmLinkLineComputer* linkLineComputer,
-                      const std::string& config, std::string& linkLibs,
+  void GetTargetFlags(const std::string& config, std::string& linkLibs,
                       std::string& flags, std::string& linkFlags,
                       std::string& frameworkPath, std::string& linkPath,
                       cmGeneratorTarget* target, bool useWatcomQuote);
@@ -344,8 +342,7 @@ public:
 
 protected:
   ///! put all the libraries for a target on into the given stream
-  void OutputLinkLibraries(cmLinkLineComputer* linkLineComputer,
-                           std::string& linkLibraries,
+  void OutputLinkLibraries(std::string& linkLibraries,
                            std::string& frameworkPath, std::string& linkPath,
                            cmGeneratorTarget&, bool relink,
                            bool forResponseFile, bool useWatcomQuote);
@@ -370,6 +367,10 @@ protected:
   std::string& CreateSafeUniqueObjectFileName(const std::string& sin,
                                               std::string const& dir_max);
 
+  virtual std::string ConvertToLinkReference(
+    std::string const& lib,
+    cmOutputConverter::OutputFormat format = cmOutputConverter::SHELL);
+
   /** Check whether the native build system supports the given
       definition.  Issues a warning.  */
   virtual bool CheckDefinition(std::string const& define) const;
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index e25eb0f..11b87e3 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -120,6 +120,13 @@ cmGlobalNinjaGenerator* cmLocalNinjaGenerator::GetGlobalNinjaGenerator()
 
 // Virtual protected methods.
 
+std::string cmLocalNinjaGenerator::ConvertToLinkReference(
+  std::string const& lib, cmOutputConverter::OutputFormat format)
+{
+  std::string path = this->GetGlobalNinjaGenerator()->ConvertToNinjaPath(lib);
+  return this->ConvertToOutputFormat(path, format);
+}
+
 std::string cmLocalNinjaGenerator::ConvertToIncludeReference(
   std::string const& path, cmOutputConverter::OutputFormat format,
   bool forceFullPaths)
@@ -482,12 +489,15 @@ std::string cmLocalNinjaGenerator::MakeCustomLauncher(
   std::string output;
   const std::vector<std::string>& outputs = ccg.GetOutputs();
   if (!outputs.empty()) {
-    output = outputs[0];
     if (ccg.GetWorkingDirectory().empty()) {
+      output = this->ConvertToOutputFormat(
+        this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(),
+                                    outputs[0]),
+        cmOutputConverter::SHELL);
+    } else {
       output =
-        this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), output);
+        this->ConvertToOutputFormat(outputs[0], cmOutputConverter::SHELL);
     }
-    output = this->ConvertToOutputFormat(output, cmOutputConverter::SHELL);
   }
   vars.Output = output.c_str();
 
diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h
index b04788d..875f8c6 100644
--- a/Source/cmLocalNinjaGenerator.h
+++ b/Source/cmLocalNinjaGenerator.h
@@ -76,6 +76,10 @@ public:
   void AppendCustomCommandDeps(cmCustomCommandGenerator const& ccg,
                                cmNinjaDeps& ninjaDeps);
 
+  std::string ConvertToLinkReference(std::string const& lib,
+                                     cmOutputConverter::OutputFormat format =
+                                       cmOutputConverter::SHELL) CM_OVERRIDE;
+
   void ComputeObjectFilenames(
     std::map<cmSourceFile const*, std::string>& mapping,
     cmGeneratorTarget const* gt = CM_NULLPTR) CM_OVERRIDE;
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 401319e..8825b46 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -141,7 +141,7 @@ void cmLocalUnixMakefileGenerator3::ComputeHomeRelativeOutputPath()
 {
   // Compute the path to use when referencing the current output
   // directory from the top output directory.
-  this->HomeRelativeOutputPath = this->MaybeConvertToRelativePath(
+  this->HomeRelativeOutputPath = this->ConvertToRelativePath(
     this->GetBinaryDirectory(), this->GetCurrentBinaryDirectory());
   if (this->HomeRelativeOutputPath == ".") {
     this->HomeRelativeOutputPath = "";
@@ -548,8 +548,7 @@ void cmLocalUnixMakefileGenerator3::WriteMakeRule(
 
   // Construct the left hand side of the rule.
   std::string tgt = cmSystemTools::ConvertToOutputPath(
-    this->MaybeConvertToRelativePath(this->GetBinaryDirectory(), target)
-      .c_str());
+    this->ConvertToRelativePath(this->GetBinaryDirectory(), target).c_str());
 
   const char* space = "";
   if (tgt.size() == 1) {
@@ -578,7 +577,7 @@ void cmLocalUnixMakefileGenerator3::WriteMakeRule(
          dep != depends.end(); ++dep) {
       replace = *dep;
       replace = cmSystemTools::ConvertToOutputPath(
-        this->MaybeConvertToRelativePath(binDir, replace).c_str());
+        this->ConvertToRelativePath(binDir, replace).c_str());
       os << cmMakeSafe(tgt) << space << ": " << cmMakeSafe(replace) << "\n";
     }
   }
@@ -970,7 +969,7 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
       // working directory will be the start-output directory.
       bool had_slash = cmd.find('/') != cmd.npos;
       if (workingDir.empty()) {
-        cmd = this->MaybeConvertToRelativePath(currentBinDir, cmd);
+        cmd = this->ConvertToRelativePath(currentBinDir, cmd);
       }
       bool has_slash = cmd.find('/') != cmd.npos;
       if (had_slash && !has_slash) {
@@ -995,8 +994,8 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
         if (!outputs.empty()) {
           if (workingDir.empty()) {
             output = this->ConvertToOutputFormat(
-              this->MaybeConvertToRelativePath(
-                this->GetCurrentBinaryDirectory(), outputs[0]),
+              this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(),
+                                          outputs[0]),
               cmOutputConverter::SHELL);
 
           } else {
@@ -1083,15 +1082,14 @@ void cmLocalUnixMakefileGenerator3::AppendCleanCommand(
     fout << "file(REMOVE_RECURSE\n";
     for (std::vector<std::string>::const_iterator f = files.begin();
          f != files.end(); ++f) {
-      std::string fc = this->MaybeConvertToRelativePath(currentBinDir, *f);
+      std::string fc = this->ConvertToRelativePath(currentBinDir, *f);
       fout << "  " << cmOutputConverter::EscapeForCMake(fc) << "\n";
     }
     fout << ")\n";
   }
   std::string remove = "$(CMAKE_COMMAND) -P ";
   remove += this->ConvertToOutputFormat(
-    this->MaybeConvertToRelativePath(this->GetCurrentBinaryDirectory(),
-                                     cleanfile),
+    this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), cleanfile),
     cmOutputConverter::SHELL);
   commands.push_back(remove);
 
@@ -1860,8 +1858,7 @@ void cmLocalUnixMakefileGenerator3::WriteDependLanguageInfo(
     }
     for (std::vector<std::string>::iterator i = includes.begin();
          i != includes.end(); ++i) {
-      cmakefileStream << "  \""
-                      << this->MaybeConvertToRelativePath(binaryDir, *i)
+      cmakefileStream << "  \"" << this->ConvertToRelativePath(binaryDir, *i)
                       << "\"\n";
     }
     cmakefileStream << "  )\n";
@@ -1926,7 +1923,7 @@ std::string cmLocalUnixMakefileGenerator3::GetRecursiveMakeCall(
   if (!tgt.empty()) {
     // The make target is always relative to the top of the build tree.
     std::string tgt2 =
-      this->MaybeConvertToRelativePath(this->GetBinaryDirectory(), tgt);
+      this->ConvertToRelativePath(this->GetBinaryDirectory(), tgt);
 
     // The target may have been written with windows paths.
     cmSystemTools::ConvertToOutputSlashes(tgt2);
@@ -2081,31 +2078,20 @@ 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));
   }
 }
-
-std::string cmLocalUnixMakefileGenerator3::MaybeConvertToRelativePath(
-  std::string const& base, std::string const& path)
-{
-  if (!cmOutputConverter::ContainedInDirectory(
-        base, path, this->GetStateSnapshot().GetDirectory())) {
-    return path;
-  }
-  return cmOutputConverter::ForceToRelativePath(base, path);
-}
diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h
index c3ecda4..fc5c8e7 100644
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@ -184,9 +184,6 @@ public:
   // Eclipse generator.
   void GetIndividualFileTargets(std::vector<std::string>& targets);
 
-  std::string MaybeConvertToRelativePath(std::string const& base,
-                                         std::string const& path);
-
 protected:
   void WriteLocalMakefile();
 
diff --git a/Source/cmMSVC60LinkLineComputer.cxx b/Source/cmMSVC60LinkLineComputer.cxx
deleted file mode 100644
index 89432ff..0000000
--- a/Source/cmMSVC60LinkLineComputer.cxx
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
-   file Copyright.txt or https://cmake.org/licensing for details.  */
-
-#include "cmMSVC60LinkLineComputer.h"
-
-#include "cmSystemTools.h"
-
-cmMSVC60LinkLineComputer::cmMSVC60LinkLineComputer(cmState::Directory stateDir)
-  : cmLinkLineComputer(stateDir)
-{
-}
-
-std::string cmMSVC60LinkLineComputer::ConvertToLinkReference(
-  std::string const& lib) const
-{
-#if defined(_WIN32) && !defined(__CYGWIN__)
-  // Work-ardound command line parsing limitations in MSVC 6.0
-  // Search for the last space.
-  std::string::size_type pos = lib.rfind(' ');
-  if (pos != lib.npos) {
-    // Find the slash after the last space, if any.
-    pos = lib.find('/', pos);
-
-    // Convert the portion of the path with a space to a short path.
-    std::string sp;
-    if (cmSystemTools::GetShortPath(lib.substr(0, pos).c_str(), sp)) {
-      // Append the rest of the path with no space.
-      sp += lib.substr(pos);
-      return sp;
-    }
-  }
-#endif
-
-  return cmLinkLineComputer::ConvertToLinkReference(lib);
-}
diff --git a/Source/cmMSVC60LinkLineComputer.h b/Source/cmMSVC60LinkLineComputer.h
deleted file mode 100644
index c159b61..0000000
--- a/Source/cmMSVC60LinkLineComputer.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
-   file Copyright.txt or https://cmake.org/licensing for details.  */
-
-#ifndef cmMSVC60LinkLineComputer_h
-#define cmMSVC60LinkLineComputer_h
-
-#include "cmLinkLineComputer.h"
-
-class cmMSVC60LinkLineComputer : public cmLinkLineComputer
-{
-public:
-  cmMSVC60LinkLineComputer(cmState::Directory stateDir);
-
-  std::string ConvertToLinkReference(std::string const& input) const
-    CM_OVERRIDE;
-};
-
-#endif
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index 9ee3933..cb20117 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -5,7 +5,6 @@
 #include "cmGeneratedFileStream.h"
 #include "cmGeneratorTarget.h"
 #include "cmGlobalUnixMakefileGenerator3.h"
-#include "cmLinkLineComputer.h"
 #include "cmLocalGenerator.h"
 #include "cmLocalUnixMakefileGenerator3.h"
 #include "cmMakefile.h"
@@ -131,16 +130,16 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
     targetFullPathPDB, cmOutputConverter::SHELL);
   // Convert to the output path to use in constructing commands.
   std::string targetOutPath = this->LocalGenerator->ConvertToOutputFormat(
-    this->LocalGenerator->MaybeConvertToRelativePath(
+    this->LocalGenerator->ConvertToRelativePath(
       this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPath),
     cmOutputConverter::SHELL);
   std::string targetOutPathReal = this->LocalGenerator->ConvertToOutputFormat(
-    this->LocalGenerator->MaybeConvertToRelativePath(
+    this->LocalGenerator->ConvertToRelativePath(
       this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathReal),
     cmOutputConverter::SHELL);
   std::string targetOutPathImport =
     this->LocalGenerator->ConvertToOutputFormat(
-      this->LocalGenerator->MaybeConvertToRelativePath(
+      this->LocalGenerator->ConvertToRelativePath(
         this->LocalGenerator->GetCurrentBinaryDirectory(),
         targetFullPathImport),
       cmOutputConverter::SHELL);
@@ -211,38 +210,32 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
   this->LocalGenerator->AppendFlags(
     linkFlags, this->GeneratorTarget->GetProperty(linkFlagsConfig));
 
-  {
-    CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
-      this->CreateLinkLineComputer(
-        this->LocalGenerator->GetStateSnapshot().GetDirectory()));
-
-    this->AddModuleDefinitionFlag(linkLineComputer.get(), linkFlags);
-  }
+  this->AddModuleDefinitionFlag(linkFlags);
 
   // Construct a list of files associated with this executable that
   // may need to be cleaned.
   std::vector<std::string> exeCleanFiles;
-  exeCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath(
+  exeCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
     this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPath));
 #ifdef _WIN32
   // There may be a manifest file for this target.  Add it to the
   // clean set just in case.
-  exeCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath(
+  exeCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
     this->LocalGenerator->GetCurrentBinaryDirectory(),
     (targetFullPath + ".manifest").c_str()));
 #endif
   if (targetNameReal != targetName) {
-    exeCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath(
+    exeCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
       this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathReal));
   }
   if (!targetNameImport.empty()) {
-    exeCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath(
+    exeCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
       this->LocalGenerator->GetCurrentBinaryDirectory(),
       targetFullPathImport));
     std::string implib;
     if (this->GeneratorTarget->GetImplibGNUtoMS(targetFullPathImport,
                                                 implib)) {
-      exeCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath(
+      exeCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
         this->LocalGenerator->GetCurrentBinaryDirectory(), implib));
     }
   }
@@ -250,7 +243,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
   // List the PDB for cleaning only when the whole target is
   // cleaned.  We do not want to delete the .pdb file just before
   // linking the target.
-  this->CleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath(
+  this->CleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
     this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathPDB));
 
   // Add the pre-build and pre-link rules building but not when relinking.
@@ -325,7 +318,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
     std::string objectDir = this->GeneratorTarget->GetSupportDirectory();
 
     objectDir = this->LocalGenerator->ConvertToOutputFormat(
-      this->LocalGenerator->MaybeConvertToRelativePath(
+      this->LocalGenerator->ConvertToRelativePath(
         this->LocalGenerator->GetCurrentBinaryDirectory(), objectDir),
       cmOutputConverter::SHELL);
     vars.ObjectDir = objectDir.c_str();
@@ -333,7 +326,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
       ? cmOutputConverter::WATCOMQUOTE
       : cmOutputConverter::SHELL;
     std::string target = this->LocalGenerator->ConvertToOutputFormat(
-      this->LocalGenerator->MaybeConvertToRelativePath(
+      this->LocalGenerator->ConvertToRelativePath(
         this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathReal),
       output);
     vars.Target = target.c_str();
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index b12e779..b969bfb 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -5,7 +5,6 @@
 #include "cmGeneratedFileStream.h"
 #include "cmGeneratorTarget.h"
 #include "cmGlobalUnixMakefileGenerator3.h"
-#include "cmLinkLineComputer.h"
 #include "cmLocalGenerator.h"
 #include "cmLocalUnixMakefileGenerator3.h"
 #include "cmMakefile.h"
@@ -160,12 +159,7 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink)
 
   this->LocalGenerator->AddConfigVariableFlags(
     extraFlags, "CMAKE_SHARED_LINKER_FLAGS", this->ConfigName);
-
-  CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
-    this->CreateLinkLineComputer(
-      this->LocalGenerator->GetStateSnapshot().GetDirectory()));
-
-  this->AddModuleDefinitionFlag(linkLineComputer.get(), extraFlags);
+  this->AddModuleDefinitionFlag(extraFlags);
 
   if (this->GeneratorTarget->GetProperty("LINK_WHAT_YOU_USE")) {
     this->LocalGenerator->AppendFlags(extraFlags, " -Wl,--no-as-needed");
@@ -190,12 +184,7 @@ void cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink)
     extraFlags, this->GeneratorTarget->GetProperty(linkFlagsConfig));
   this->LocalGenerator->AddConfigVariableFlags(
     extraFlags, "CMAKE_MODULE_LINKER_FLAGS", this->ConfigName);
-
-  CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
-    this->CreateLinkLineComputer(
-      this->LocalGenerator->GetStateSnapshot().GetDirectory()));
-
-  this->AddModuleDefinitionFlag(linkLineComputer.get(), extraFlags);
+  this->AddModuleDefinitionFlag(extraFlags);
 
   this->WriteLibraryRules(linkRuleVar, extraFlags, relink);
 }
@@ -316,20 +305,20 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
     targetFullPathPDB, cmOutputConverter::SHELL);
 
   std::string targetOutPath = this->LocalGenerator->ConvertToOutputFormat(
-    this->LocalGenerator->MaybeConvertToRelativePath(
+    this->LocalGenerator->ConvertToRelativePath(
       this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPath),
     cmOutputConverter::SHELL);
   std::string targetOutPathSO = this->LocalGenerator->ConvertToOutputFormat(
-    this->LocalGenerator->MaybeConvertToRelativePath(
+    this->LocalGenerator->ConvertToRelativePath(
       this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathSO),
     cmOutputConverter::SHELL);
   std::string targetOutPathReal = this->LocalGenerator->ConvertToOutputFormat(
-    this->LocalGenerator->MaybeConvertToRelativePath(
+    this->LocalGenerator->ConvertToRelativePath(
       this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathReal),
     cmOutputConverter::SHELL);
   std::string targetOutPathImport =
     this->LocalGenerator->ConvertToOutputFormat(
-      this->LocalGenerator->MaybeConvertToRelativePath(
+      this->LocalGenerator->ConvertToRelativePath(
         this->LocalGenerator->GetCurrentBinaryDirectory(),
         targetFullPathImport),
       cmOutputConverter::SHELL);
@@ -377,24 +366,24 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
 
   // Clean files associated with this library.
   std::vector<std::string> libCleanFiles;
-  libCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath(
+  libCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
     this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPath));
   if (targetNameReal != targetName) {
-    libCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath(
+    libCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
       this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathReal));
   }
   if (targetNameSO != targetName && targetNameSO != targetNameReal) {
-    libCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath(
+    libCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
       this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathSO));
   }
   if (!targetNameImport.empty()) {
-    libCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath(
+    libCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
       this->LocalGenerator->GetCurrentBinaryDirectory(),
       targetFullPathImport));
     std::string implib;
     if (this->GeneratorTarget->GetImplibGNUtoMS(targetFullPathImport,
                                                 implib)) {
-      libCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath(
+      libCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
         this->LocalGenerator->GetCurrentBinaryDirectory(), implib));
     }
   }
@@ -402,14 +391,14 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
   // List the PDB for cleaning only when the whole target is
   // cleaned.  We do not want to delete the .pdb file just before
   // linking the target.
-  this->CleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath(
+  this->CleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
     this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathPDB));
 
 #ifdef _WIN32
   // There may be a manifest file for this target.  Add it to the
   // clean set just in case.
   if (this->GeneratorTarget->GetType() != cmState::STATIC_LIBRARY) {
-    libCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath(
+    libCleanFiles.push_back(this->LocalGenerator->ConvertToRelativePath(
       this->LocalGenerator->GetCurrentBinaryDirectory(),
       (targetFullPath + ".manifest").c_str()));
   }
@@ -548,7 +537,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
     std::string objectDir = this->GeneratorTarget->GetSupportDirectory();
 
     objectDir = this->LocalGenerator->ConvertToOutputFormat(
-      this->LocalGenerator->MaybeConvertToRelativePath(
+      this->LocalGenerator->ConvertToRelativePath(
         this->LocalGenerator->GetCurrentBinaryDirectory(), objectDir),
       cmOutputConverter::SHELL);
 
@@ -557,7 +546,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
       ? cmOutputConverter::WATCOMQUOTE
       : cmOutputConverter::SHELL;
     std::string target = this->LocalGenerator->ConvertToOutputFormat(
-      this->LocalGenerator->MaybeConvertToRelativePath(
+      this->LocalGenerator->ConvertToRelativePath(
         this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathReal),
       output);
     vars.Target = target.c_str();
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 95f883e..e70f09e 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -10,7 +10,6 @@
 #include "cmGeneratorExpression.h"
 #include "cmGeneratorTarget.h"
 #include "cmGlobalUnixMakefileGenerator3.h"
-#include "cmLinkLineComputer.h"
 #include "cmLocalGenerator.h"
 #include "cmLocalUnixMakefileGenerator3.h"
 #include "cmMakefile.h"
@@ -167,7 +166,7 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
       for (std::vector<std::string>::const_iterator o = outputs.begin();
            o != outputs.end(); ++o) {
         this->CleanFiles.push_back(
-          this->LocalGenerator->MaybeConvertToRelativePath(currentBinDir, *o));
+          this->LocalGenerator->ConvertToRelativePath(currentBinDir, *o));
       }
     }
   }
@@ -210,8 +209,8 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules()
     << this->GlobalGenerator->IncludeDirective << " " << root
     << cmSystemTools::ConvertToOutputPath(
          this->LocalGenerator
-           ->MaybeConvertToRelativePath(
-             this->LocalGenerator->GetBinaryDirectory(), dependFileNameFull)
+           ->ConvertToRelativePath(this->LocalGenerator->GetBinaryDirectory(),
+                                   dependFileNameFull)
            .c_str())
     << "\n\n";
 
@@ -222,7 +221,7 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules()
       << this->GlobalGenerator->IncludeDirective << " " << root
       << cmSystemTools::ConvertToOutputPath(
            this->LocalGenerator
-             ->MaybeConvertToRelativePath(
+             ->ConvertToRelativePath(
                this->LocalGenerator->GetBinaryDirectory(),
                this->ProgressFileNameFull)
              .c_str())
@@ -257,9 +256,8 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules()
     << this->GlobalGenerator->IncludeDirective << " " << root
     << cmSystemTools::ConvertToOutputPath(
          this->LocalGenerator
-           ->MaybeConvertToRelativePath(
-             this->LocalGenerator->GetBinaryDirectory(),
-             this->FlagFileNameFull)
+           ->ConvertToRelativePath(this->LocalGenerator->GetBinaryDirectory(),
+                                   this->FlagFileNameFull)
            .c_str())
     << "\n\n";
 }
@@ -316,9 +314,9 @@ void cmMakefileTargetGenerator::MacOSXContentGeneratorType::operator()(
   output += "/";
   output += cmSystemTools::GetFilenameName(input);
   this->Generator->CleanFiles.push_back(
-    this->Generator->LocalGenerator->MaybeConvertToRelativePath(
+    this->Generator->LocalGenerator->ConvertToRelativePath(
       this->Generator->LocalGenerator->GetCurrentBinaryDirectory(), output));
-  output = this->Generator->LocalGenerator->MaybeConvertToRelativePath(
+  output = this->Generator->LocalGenerator->ConvertToRelativePath(
     this->Generator->LocalGenerator->GetBinaryDirectory(), output);
 
   // Create a rule to copy the content into the bundle.
@@ -520,13 +518,13 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
     }
 
     targetOutPathReal = this->LocalGenerator->ConvertToOutputFormat(
-      this->LocalGenerator->MaybeConvertToRelativePath(
+      this->LocalGenerator->ConvertToRelativePath(
         this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathReal),
       cmOutputConverter::SHELL);
     targetOutPathPDB = this->LocalGenerator->ConvertToOutputFormat(
       targetFullPathPDB, cmOutputConverter::SHELL);
     targetOutPathCompilePDB = this->LocalGenerator->ConvertToOutputFormat(
-      this->LocalGenerator->MaybeConvertToRelativePath(
+      this->LocalGenerator->ConvertToRelativePath(
         this->LocalGenerator->GetCurrentBinaryDirectory(),
         targetFullPathCompilePDB),
       cmOutputConverter::SHELL);
@@ -552,13 +550,13 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
   vars.Object = shellObj.c_str();
   std::string objectDir = this->GeneratorTarget->GetSupportDirectory();
   objectDir = this->LocalGenerator->ConvertToOutputFormat(
-    this->LocalGenerator->MaybeConvertToRelativePath(
+    this->LocalGenerator->ConvertToRelativePath(
       this->LocalGenerator->GetCurrentBinaryDirectory(), objectDir),
     cmOutputConverter::SHELL);
   vars.ObjectDir = objectDir.c_str();
   std::string objectFileDir = cmSystemTools::GetFilenamePath(obj);
   objectFileDir = this->LocalGenerator->ConvertToOutputFormat(
-    this->LocalGenerator->MaybeConvertToRelativePath(
+    this->LocalGenerator->ConvertToRelativePath(
       this->LocalGenerator->GetCurrentBinaryDirectory(), objectFileDir),
     cmOutputConverter::SHELL);
   vars.ObjectFileDir = objectFileDir.c_str();
@@ -906,7 +904,7 @@ bool cmMakefileTargetGenerator::WriteMakeRule(
     // Touch the extra output so "make" knows that it was updated,
     // but only if the output was acually created.
     std::string const out = this->LocalGenerator->ConvertToOutputFormat(
-      this->LocalGenerator->MaybeConvertToRelativePath(binDir, *o),
+      this->LocalGenerator->ConvertToRelativePath(binDir, *o),
       cmOutputConverter::SHELL);
     std::vector<std::string> output_commands;
 
@@ -1202,8 +1200,7 @@ void cmMakefileTargetGenerator::WriteObjectsVariable(
   for (std::vector<std::string>::const_iterator i =
          this->ExternalObjects.begin();
        i != this->ExternalObjects.end(); ++i) {
-    object =
-      this->LocalGenerator->MaybeConvertToRelativePath(currentBinDir, *i);
+    object = this->LocalGenerator->ConvertToRelativePath(currentBinDir, *i);
     *this->BuildFileStream << " " << lineContinue << "\n"
                            << this->Makefile->GetSafeDefinition(
                                 "CMAKE_OBJECT_NAME");
@@ -1237,7 +1234,7 @@ public:
   {
     // Construct the name of the next object.
     this->NextObject = this->LocalGenerator->ConvertToOutputFormat(
-      this->LocalGenerator->MaybeConvertToRelativePath(
+      this->LocalGenerator->ConvertToRelativePath(
         this->LocalGenerator->GetCurrentBinaryDirectory(), obj),
       cmOutputConverter::RESPONSE);
 
@@ -1292,7 +1289,7 @@ void cmMakefileTargetGenerator::WriteTargetDriverRule(
     this->LocalGenerator->GetRelativeTargetDirectory(this->GeneratorTarget);
   std::string buildTargetRuleName = dir;
   buildTargetRuleName += relink ? "/preinstall" : "/build";
-  buildTargetRuleName = this->LocalGenerator->MaybeConvertToRelativePath(
+  buildTargetRuleName = this->LocalGenerator->ConvertToRelativePath(
     this->LocalGenerator->GetBinaryDirectory(), buildTargetRuleName);
 
   // Build the list of target outputs to drive.
@@ -1482,7 +1479,7 @@ void cmMakefileTargetGenerator::CreateLinkScript(
   // Create the makefile command to invoke the link script.
   std::string link_command = "$(CMAKE_COMMAND) -E cmake_link_script ";
   link_command += this->LocalGenerator->ConvertToOutputFormat(
-    this->LocalGenerator->MaybeConvertToRelativePath(
+    this->LocalGenerator->ConvertToRelativePath(
       this->LocalGenerator->GetCurrentBinaryDirectory(), linkScriptName),
     cmOutputConverter::SHELL);
   link_command += " --verbose=$(VERBOSE)";
@@ -1580,29 +1577,15 @@ std::string cmMakefileTargetGenerator::CreateResponseFile(
   return responseFileName;
 }
 
-cmLinkLineComputer* cmMakefileTargetGenerator::CreateLinkLineComputer(
-  cmState::Directory stateDir)
-{
-  if (this->Makefile->IsOn("MSVC60")) {
-    return this->GlobalGenerator->CreateMSVC60LinkLineComputer(stateDir);
-  }
-  return this->GlobalGenerator->CreateLinkLineComputer(stateDir);
-}
-
 void cmMakefileTargetGenerator::CreateLinkLibs(
   std::string& linkLibs, bool relink, bool useResponseFile,
   std::vector<std::string>& makefile_depends, bool useWatcomQuote)
 {
   std::string frameworkPath;
   std::string linkPath;
-
-  CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
-    this->CreateLinkLineComputer(
-      this->LocalGenerator->GetStateSnapshot().GetDirectory()));
-
-  this->LocalGenerator->OutputLinkLibraries(
-    linkLineComputer.get(), linkLibs, frameworkPath, linkPath,
-    *this->GeneratorTarget, relink, useResponseFile, useWatcomQuote);
+  this->LocalGenerator->OutputLinkLibraries(linkLibs, frameworkPath, linkPath,
+                                            *this->GeneratorTarget, relink,
+                                            useResponseFile, useWatcomQuote);
   linkLibs = frameworkPath + linkPath + linkLibs;
 
   if (useResponseFile && linkLibs.find_first_not_of(' ') != linkLibs.npos) {
@@ -1733,14 +1716,14 @@ void cmMakefileTargetGenerator::GenDefFile(
       cmd, cmOutputConverter::SHELL);
     cmd += " -E __create_def ";
     cmd += this->LocalGenerator->ConvertToOutputFormat(
-      this->LocalGenerator->MaybeConvertToRelativePath(
+      this->LocalGenerator->ConvertToRelativePath(
         this->LocalGenerator->GetCurrentBinaryDirectory(), name_of_def_file),
       cmOutputConverter::SHELL);
     cmd += " ";
     std::string objlist_file = name_of_def_file;
     objlist_file += ".objs";
     cmd += this->LocalGenerator->ConvertToOutputFormat(
-      this->LocalGenerator->MaybeConvertToRelativePath(
+      this->LocalGenerator->ConvertToRelativePath(
         this->LocalGenerator->GetCurrentBinaryDirectory(), objlist_file),
       cmOutputConverter::SHELL);
     real_link_commands.insert(real_link_commands.begin(), cmd);
@@ -1761,7 +1744,7 @@ void cmMakefileTargetGenerator::GenDefFile(
     linkFlags += " ";
     linkFlags += this->Makefile->GetSafeDefinition("CMAKE_LINK_DEF_FILE_FLAG");
     linkFlags += this->LocalGenerator->ConvertToOutputFormat(
-      this->LocalGenerator->MaybeConvertToRelativePath(
+      this->LocalGenerator->ConvertToRelativePath(
         this->LocalGenerator->GetCurrentBinaryDirectory(), name_of_def_file),
       cmOutputConverter::SHELL);
     linkFlags += " ";
diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h
index 6d367bd..df7b6aa 100644
--- a/Source/cmMakefileTargetGenerator.h
+++ b/Source/cmMakefileTargetGenerator.h
@@ -140,8 +140,6 @@ protected:
                         std::vector<std::string>& makefile_commands,
                         std::vector<std::string>& makefile_depends);
 
-  cmLinkLineComputer* CreateLinkLineComputer(cmState::Directory stateDir);
-
   /** Create a response file with the given set of options.  Returns
       the relative path from the target build working directory to the
       response file name.  */
diff --git a/Source/cmMakefileUtilityTargetGenerator.cxx b/Source/cmMakefileUtilityTargetGenerator.cxx
index ecb29cb..f40c8fa 100644
--- a/Source/cmMakefileUtilityTargetGenerator.cxx
+++ b/Source/cmMakefileUtilityTargetGenerator.cxx
@@ -46,7 +46,7 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles()
       << this->GlobalGenerator->IncludeDirective << " " << root
       << cmSystemTools::ConvertToOutputPath(
            this->LocalGenerator
-             ->MaybeConvertToRelativePath(
+             ->ConvertToRelativePath(
                this->LocalGenerator->GetBinaryDirectory(),
                this->ProgressFileNameFull)
              .c_str())
diff --git a/Source/cmNinjaLinkLineComputer.cxx b/Source/cmNinjaLinkLineComputer.cxx
deleted file mode 100644
index 4bc7133..0000000
--- a/Source/cmNinjaLinkLineComputer.cxx
+++ /dev/null
@@ -1,19 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
-   file Copyright.txt or https://cmake.org/licensing for details.  */
-
-#include "cmNinjaLinkLineComputer.h"
-#include "cmGlobalNinjaGenerator.h"
-
-cmNinjaLinkLineComputer::cmNinjaLinkLineComputer(cmState::Directory stateDir,
-                                                 std::string const& prefix)
-  : cmLinkLineComputer(stateDir)
-  , NinjaPrefix(prefix)
-{
-}
-
-std::string cmNinjaLinkLineComputer::ConvertToLinkReference(
-  std::string const& lib) const
-{
-  return cmGlobalNinjaGenerator::ConvertToNinjaPath(lib, this->StateDir,
-                                                    this->NinjaPrefix);
-}
diff --git a/Source/cmNinjaLinkLineComputer.h b/Source/cmNinjaLinkLineComputer.h
deleted file mode 100644
index 370f6ce..0000000
--- a/Source/cmNinjaLinkLineComputer.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
-   file Copyright.txt or https://cmake.org/licensing for details.  */
-
-#ifndef cmNinjaLinkLineComputer_h
-#define cmNinjaLinkLineComputer_h
-
-#include "cmLinkLineComputer.h"
-#include "cmState.h"
-
-class cmNinjaLinkLineComputer : public cmLinkLineComputer
-{
-public:
-  cmNinjaLinkLineComputer(cmState::Directory stateDir,
-                          std::string const& ninjaPrefix);
-
-  std::string ConvertToLinkReference(std::string const& input) const
-    CM_OVERRIDE;
-
-private:
-  std::string NinjaPrefix;
-};
-
-#endif
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 45baf8d..095c703 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -8,7 +8,6 @@
 #include "cmGeneratedFileStream.h"
 #include "cmGeneratorTarget.h"
 #include "cmGlobalNinjaGenerator.h"
-#include "cmLinkLineComputer.h"
 #include "cmLocalGenerator.h"
 #include "cmLocalNinjaGenerator.h"
 #include "cmMakefile.h"
@@ -471,14 +470,9 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
   vars["TARGET_FILE"] =
     localGen.ConvertToOutputFormat(targetOutputReal, cmOutputConverter::SHELL);
 
-  CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
-    this->GetGlobalGenerator()->CreateLinkLineComputer(
-      this->GetLocalGenerator()->GetStateSnapshot().GetDirectory()));
-
-  localGen.GetTargetFlags(linkLineComputer.get(), this->GetConfigName(),
-                          vars["LINK_LIBRARIES"], vars["FLAGS"],
-                          vars["LINK_FLAGS"], frameworkPath, linkPath,
-                          &genTarget, useWatcomQuote);
+  localGen.GetTargetFlags(this->GetConfigName(), vars["LINK_LIBRARIES"],
+                          vars["FLAGS"], vars["LINK_FLAGS"], frameworkPath,
+                          linkPath, &genTarget, useWatcomQuote);
   if (this->GetMakefile()->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS") &&
       (gt.GetType() == cmState::SHARED_LIBRARY ||
        gt.IsExecutableWithExports())) {
@@ -503,7 +497,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
 
   this->addPoolNinjaVariable("JOB_POOL_LINK", &gt, vars);
 
-  this->AddModuleDefinitionFlag(linkLineComputer.get(), vars["LINK_FLAGS"]);
+  this->AddModuleDefinitionFlag(vars["LINK_FLAGS"]);
   vars["LINK_FLAGS"] =
     cmGlobalNinjaGenerator::EncodeLiteral(vars["LINK_FLAGS"]);
 
diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx
index 05e7d63..2ef603b 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
 {
@@ -57,35 +76,44 @@ static bool cmOutputConverterNotAbove(const char* a, const char* b)
           cmSystemTools::IsSubDirectory(a, b));
 }
 
-bool cmOutputConverter::ContainedInDirectory(std::string const& local_path,
-                                             std::string const& remote_path,
-                                             cmState::Directory directory)
+std::string cmOutputConverter::ConvertToRelativePath(
+  const std::vector<std::string>& local, const std::string& in_remote,
+  bool force) const
 {
-  const std::string relativePathTopBinary =
-    directory.GetRelativePathTopBinary();
-  const std::string relativePathTopSource =
-    directory.GetRelativePathTopSource();
-
-  const bool bothInBinary =
-    cmOutputConverterNotAbove(local_path.c_str(),
-                              relativePathTopBinary.c_str()) &&
-    cmOutputConverterNotAbove(remote_path.c_str(),
-                              relativePathTopBinary.c_str());
-
-  const bool bothInSource =
-    cmOutputConverterNotAbove(local_path.c_str(),
-                              relativePathTopSource.c_str()) &&
-    cmOutputConverterNotAbove(remote_path.c_str(),
-                              relativePathTopSource.c_str());
-
-  return bothInSource || bothInBinary;
+  std::string local_path = cmSystemTools::JoinPath(local);
+  return force ? this->ForceToRelativePath(local_path, in_remote)
+               : this->ConvertToRelativePath(local_path, in_remote);
 }
 
 std::string cmOutputConverter::ConvertToRelativePath(
   std::string const& local_path, std::string const& remote_path) const
 {
-  if (!ContainedInDirectory(local_path, remote_path,
-                            this->StateSnapshot.GetDirectory())) {
+  // The paths should never be quoted.
+  assert(local_path[0] != '\"');
+  assert(remote_path[0] != '\"');
+
+  // The local path should never have a trailing slash.
+  assert(local_path.empty() || local_path[local_path.size() - 1] != '/');
+
+  // If the path is already relative then just return the path.
+  if (!cmSystemTools::FileIsFullPath(remote_path.c_str())) {
+    return remote_path;
+  }
+
+  // Skip conversion if the path and local are not both in the source
+  // or both in the binary tree.
+  if (!((cmOutputConverterNotAbove(
+           local_path.c_str(),
+           this->StateSnapshot.GetDirectory().GetRelativePathTopBinary()) &&
+         cmOutputConverterNotAbove(
+           remote_path.c_str(),
+           this->StateSnapshot.GetDirectory().GetRelativePathTopBinary())) ||
+        (cmOutputConverterNotAbove(
+           local_path.c_str(),
+           this->StateSnapshot.GetDirectory().GetRelativePathTopSource()) &&
+         cmOutputConverterNotAbove(
+           remote_path.c_str(),
+           this->StateSnapshot.GetDirectory().GetRelativePathTopSource())))) {
     return remote_path;
   }
 
@@ -220,11 +248,10 @@ std::string cmOutputConverter::EscapeForShell(const std::string& str,
   if (this->GetState()->UseNMake()) {
     flags |= Shell_Flag_NMake;
   }
-  if (!this->GetState()->UseWindowsShell()) {
-    flags |= Shell_Flag_IsUnix;
-  }
 
-  return Shell__GetArgument(str.c_str(), flags);
+  return this->GetState()->UseWindowsShell()
+    ? Shell_GetArgumentForWindows(str.c_str(), flags)
+    : Shell_GetArgumentForUnix(str.c_str(), flags);
 }
 
 std::string cmOutputConverter::EscapeForCMake(const std::string& str)
@@ -253,7 +280,7 @@ std::string cmOutputConverter::EscapeForCMake(const std::string& str)
 std::string cmOutputConverter::EscapeWindowsShellArgument(const char* arg,
                                                           int shell_flags)
 {
-  return Shell__GetArgument(arg, shell_flags);
+  return Shell_GetArgumentForWindows(arg, shell_flags);
 }
 
 cmOutputConverter::FortranFormat cmOutputConverter::GetFortranFormat(
@@ -339,10 +366,10 @@ int cmOutputConverter::Shell__CharNeedsQuotesOnWindows(char c)
           (c == '>') || (c == '|') || (c == '^'));
 }
 
-int cmOutputConverter::Shell__CharNeedsQuotes(char c, int flags)
+int cmOutputConverter::Shell__CharNeedsQuotes(char c, int isUnix, int flags)
 {
   /* On Windows the built-in command shell echo never needs quotes.  */
-  if (!(flags & Shell_Flag_IsUnix) && (flags & Shell_Flag_EchoWindows)) {
+  if (!isUnix && (flags & Shell_Flag_EchoWindows)) {
     return 0;
   }
 
@@ -351,7 +378,7 @@ int cmOutputConverter::Shell__CharNeedsQuotes(char c, int flags)
     return 1;
   }
 
-  if (flags & Shell_Flag_IsUnix) {
+  if (isUnix) {
     /* On UNIX several special characters need quotes to preserve them.  */
     if (Shell__CharNeedsQuotesOnUnix(c)) {
       return 1;
@@ -409,7 +436,8 @@ flag later when we understand applications of this better.
 */
 #define KWSYS_SYSTEM_SHELL_QUOTE_MAKE_VARIABLES 0
 
-int cmOutputConverter::Shell__ArgumentNeedsQuotes(const char* in, int flags)
+int cmOutputConverter::Shell__ArgumentNeedsQuotes(const char* in, int isUnix,
+                                                  int flags)
 {
   /* The empty string needs quotes.  */
   if (!*in) {
@@ -441,14 +469,14 @@ int cmOutputConverter::Shell__ArgumentNeedsQuotes(const char* in, int flags)
       }
 
       /* Check whether this character needs quotes.  */
-      if (Shell__CharNeedsQuotes(*c, flags)) {
+      if (Shell__CharNeedsQuotes(*c, isUnix, flags)) {
         return 1;
       }
     }
   }
 
   /* On Windows some single character arguments need quotes.  */
-  if (flags & Shell_Flag_IsUnix && *in && !*(in + 1)) {
+  if (!isUnix && *in && !*(in + 1)) {
     char c = *in;
     if ((c == '?') || (c == '&') || (c == '^') || (c == '|') || (c == '#')) {
       return 1;
@@ -458,7 +486,8 @@ int cmOutputConverter::Shell__ArgumentNeedsQuotes(const char* in, int flags)
   return 0;
 }
 
-std::string cmOutputConverter::Shell__GetArgument(const char* in, int flags)
+std::string cmOutputConverter::Shell__GetArgument(const char* in, int isUnix,
+                                                  int flags)
 {
   std::ostringstream out;
 
@@ -469,11 +498,11 @@ std::string cmOutputConverter::Shell__GetArgument(const char* in, int flags)
   int windows_backslashes = 0;
 
   /* Whether the argument must be quoted.  */
-  int needQuotes = Shell__ArgumentNeedsQuotes(in, flags);
+  int needQuotes = Shell__ArgumentNeedsQuotes(in, isUnix, flags);
   if (needQuotes) {
     /* Add the opening quote for this argument.  */
     if (flags & Shell_Flag_WatcomQuote) {
-      if (flags & Shell_Flag_IsUnix) {
+      if (isUnix) {
         out << '"';
       }
       out << '\'';
@@ -505,7 +534,7 @@ std::string cmOutputConverter::Shell__GetArgument(const char* in, int flags)
     }
 
     /* Check whether this character needs escaping for the shell.  */
-    if (flags & Shell_Flag_IsUnix) {
+    if (isUnix) {
       /* On Unix a few special characters need escaping even inside a
          quoted argument.  */
       if (*c == '\\' || *c == '"' || *c == '`' || *c == '$') {
@@ -602,7 +631,7 @@ std::string cmOutputConverter::Shell__GetArgument(const char* in, int flags)
     /* Add the closing quote for this argument.  */
     if (flags & Shell_Flag_WatcomQuote) {
       out << '\'';
-      if (flags & Shell_Flag_IsUnix) {
+      if (isUnix) {
         out << '"';
       }
     } else {
@@ -612,3 +641,15 @@ std::string cmOutputConverter::Shell__GetArgument(const char* in, int flags)
 
   return out.str();
 }
+
+std::string cmOutputConverter::Shell_GetArgumentForWindows(const char* in,
+                                                           int flags)
+{
+  return Shell__GetArgument(in, 0, flags);
+}
+
+std::string cmOutputConverter::Shell_GetArgumentForUnix(const char* in,
+                                                        int flags)
+{
+  return Shell__GetArgument(in, 1, flags);
+}
diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h
index 596bdf0..5979eaa 100644
--- a/Source/cmOutputConverter.h
+++ b/Source/cmOutputConverter.h
@@ -26,10 +26,15 @@ 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);
 
   /**
-   * Flags to pass to Shell_GetArgument.  These modify the generated
+   * Flags to pass to Shell_GetArgumentForWindows or
+   * Shell_GetArgumentForUnix.  These modify the generated
    * quoting and escape sequences to work under alternative
    * environments.
    */
@@ -62,11 +67,19 @@ public:
     Shell_Flag_AllowMakeVariables = (1 << 6),
 
     /** The target shell quoting uses extra single Quotes for Watcom tools.  */
-    Shell_Flag_WatcomQuote = (1 << 7),
-
-    Shell_Flag_IsUnix = (1 << 8),
+    Shell_Flag_WatcomQuote = (1 << 7)
   };
 
+  /**
+   * Transform the given command line argument for use in a Windows or
+   * Unix shell.  Returns a pointer to the end of the command line
+   * argument in the provided output buffer.  Flags may be passed to
+   * modify the generated quoting and escape sequences to work under
+   * alternative environments.
+   */
+  static std::string Shell_GetArgumentForWindows(const char* in, int flags);
+  static std::string Shell_GetArgumentForUnix(const char* in, int flags);
+
   std::string EscapeForShell(const std::string& str, bool makeVars = false,
                              bool forEcho = false,
                              bool useWatcomQuote = false) const;
@@ -86,9 +99,16 @@ public:
   };
   static FortranFormat GetFortranFormat(const char* value);
 
-  static bool ContainedInDirectory(std::string const& local_path,
-                                   std::string const& remote_path,
-                                   cmState::Directory directory);
+  /**
+   * Convert the given remote path to a relative path with respect to
+   * the given local path.  The local path must be given in component
+   * form (see SystemTools::SplitPath) without a trailing slash.  The
+   * remote path must use forward slashes and not already be escaped
+   * or quoted.
+   */
+  std::string ConvertToRelativePath(const std::vector<std::string>& local,
+                                    const std::string& in_remote,
+                                    bool force = false) const;
 
   /**
    * Convert the given remote path to a relative path with respect to
@@ -114,11 +134,11 @@ private:
   static int Shell__CharIsWhitespace(char c);
   static int Shell__CharNeedsQuotesOnUnix(char c);
   static int Shell__CharNeedsQuotesOnWindows(char c);
-  static int Shell__CharNeedsQuotes(char c, int flags);
+  static int Shell__CharNeedsQuotes(char c, int isUnix, int flags);
   static int Shell__CharIsMakeVariableName(char c);
   static const char* Shell__SkipMakeVariables(const char* c);
-  static int Shell__ArgumentNeedsQuotes(const char* in, int flags);
-  static std::string Shell__GetArgument(const char* in, int flags);
+  static int Shell__ArgumentNeedsQuotes(const char* in, int isUnix, int flags);
+  static std::string Shell__GetArgument(const char* in, int isUnix, int flags);
 
 private:
   cmState::Snapshot StateSnapshot;
diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx
index a58510e..a2bdf49 100644
--- a/Source/cmServerProtocol.cxx
+++ b/Source/cmServerProtocol.cxx
@@ -7,7 +7,6 @@
 #include "cmFileMonitor.h"
 #include "cmGeneratorTarget.h"
 #include "cmGlobalGenerator.h"
-#include "cmLinkLineComputer.h"
 #include "cmListFileCache.h"
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
@@ -729,12 +728,8 @@ static Json::Value DumpTarget(cmGeneratorTarget* target,
     std::string linkLanguageFlags;
     std::string frameworkPath;
     std::string linkPath;
-    CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
-      lg->GetGlobalGenerator()->CreateLinkLineComputer(
-        lg->GetStateSnapshot().GetDirectory()));
-    lg->GetTargetFlags(linkLineComputer.get(), config, linkLibs,
-                       linkLanguageFlags, linkFlags, frameworkPath, linkPath,
-                       target, false);
+    lg->GetTargetFlags(config, linkLibs, linkLanguageFlags, linkFlags,
+                       frameworkPath, linkPath, target, false);
 
     linkLibs = cmSystemTools::TrimWhitespace(linkLibs);
     linkFlags = cmSystemTools::TrimWhitespace(linkFlags);
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 4024ddd..14124f8 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -12,7 +12,6 @@
 #include "cmGeneratorTarget.h"
 #include "cmGlobalGenerator.h"
 #include "cmGlobalGeneratorFactory.h"
-#include "cmLinkLineComputer.h"
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
 #include "cmMessenger.h"
@@ -583,10 +582,8 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
     gg->CreateGenerationObjects();
     cmGeneratorTarget* gtgt = gg->FindGeneratorTarget(tgt->GetName());
     cmLocalGenerator* lg = gtgt->GetLocalGenerator();
-    CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
-      gg->CreateLinkLineComputer(lg->GetStateSnapshot().GetDirectory()));
-    lg->GetTargetFlags(linkLineComputer.get(), buildType, linkLibs, flags,
-                       linkFlags, frameworkPath, linkPath, gtgt, false);
+    lg->GetTargetFlags(buildType, linkLibs, flags, linkFlags, frameworkPath,
+                       linkPath, gtgt, false);
     linkLibs = frameworkPath + linkPath + linkLibs;
 
     printf("%s\n", linkLibs.c_str());
diff --git a/bootstrap b/bootstrap
index fb8b1eb..889cc33 100755
--- a/bootstrap
+++ b/bootstrap
@@ -297,8 +297,6 @@ CMAKE_CXX_SOURCES="\
   cmFileTimeComparison \
   cmGlobalUnixMakefileGenerator3 \
   cmLocalUnixMakefileGenerator3 \
-  cmLinkLineComputer \
-  cmMSVC60LinkLineComputer \
   cmMakefileExecutableTargetGenerator \
   cmMakefileLibraryTargetGenerator \
   cmMakefileTargetGenerator \

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

Summary of changes:
 Source/CMakeLists.txt                          |    6 --
 Source/cmCommonTargetGenerator.cxx             |   10 +-
 Source/cmCommonTargetGenerator.h               |    4 +-
 Source/cmDependsFortran.cxx                    |   45 ++++-----
 Source/cmDependsFortran.h                      |    3 -
 Source/cmGhsMultiTargetGenerator.cxx           |    8 +-
 Source/cmGlobalGenerator.cxx                   |   14 ---
 Source/cmGlobalGenerator.h                     |    7 --
 Source/cmGlobalNinjaGenerator.cxx              |   39 ++------
 Source/cmGlobalNinjaGenerator.h                |    7 --
 Source/cmGlobalUnixMakefileGenerator3.cxx      |    6 +-
 Source/cmGlobalXCodeGenerator.cxx              |    6 +-
 Source/cmLinkLineComputer.cxx                  |   27 ------
 Source/cmLinkLineComputer.h                    |   21 -----
 Source/cmLocalGenerator.cxx                    |   70 +++++++++-----
 Source/cmLocalGenerator.h                      |   11 ++-
 Source/cmLocalNinjaGenerator.cxx               |   16 +++-
 Source/cmLocalNinjaGenerator.h                 |    4 +
 Source/cmLocalUnixMakefileGenerator3.cxx       |   40 +++-----
 Source/cmLocalUnixMakefileGenerator3.h         |    3 -
 Source/cmMSVC60LinkLineComputer.cxx            |   35 -------
 Source/cmMSVC60LinkLineComputer.h              |   18 ----
 Source/cmMakefileExecutableTargetGenerator.cxx |   31 +++---
 Source/cmMakefileLibraryTargetGenerator.cxx    |   41 +++-----
 Source/cmMakefileTargetGenerator.cxx           |   63 +++++--------
 Source/cmMakefileTargetGenerator.h             |    2 -
 Source/cmMakefileUtilityTargetGenerator.cxx    |    2 +-
 Source/cmNinjaLinkLineComputer.cxx             |   19 ----
 Source/cmNinjaLinkLineComputer.h               |   23 -----
 Source/cmNinjaNormalTargetGenerator.cxx        |   14 +--
 Source/cmOutputConverter.cxx                   |  119 ++++++++++++++++--------
 Source/cmOutputConverter.h                     |   40 ++++++--
 Source/cmServerProtocol.cxx                    |    9 +-
 Source/cmake.cxx                               |    7 +-
 bootstrap                                      |    2 -
 35 files changed, 295 insertions(+), 477 deletions(-)
 delete mode 100644 Source/cmLinkLineComputer.cxx
 delete mode 100644 Source/cmLinkLineComputer.h
 delete mode 100644 Source/cmMSVC60LinkLineComputer.cxx
 delete mode 100644 Source/cmMSVC60LinkLineComputer.h
 delete mode 100644 Source/cmNinjaLinkLineComputer.cxx
 delete mode 100644 Source/cmNinjaLinkLineComputer.h


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list