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  742fcc25999fa30d348dc6df35cd07ecbdcb6fe9 (commit)
       via  b57b7870f6e188136ec0bae6ebc555c882feee90 (commit)
       via  076d39926f899f88e30b4128c2c835ab35091a31 (commit)
       via  b06615050293a04b7e7ef8ccf97ec706351d761e (commit)
       via  7a7a02193745d52183cdd203deb1a93d49f797e7 (commit)
       via  639cbcdaf9e7dc5ae9e4156ec2f21ad1c8634acf (commit)
       via  62e5fc1dbf477bb2628dee9d2e9bf143609f441b (commit)
       via  37cab7eb17b505a18f534408307797a5e126663e (commit)
       via  0e16f8f8067ae721d23e842b83e0e24d4e5d2b49 (commit)
       via  47e6e46fcf85e73b65b0f93be4e1d9aeb72b9579 (commit)
       via  2f81fb21790dac9f6036d804d68f108bb498b720 (commit)
       via  cc911145ee8a4a8bb1fcea6fecf77cba37fcf261 (commit)
       via  2bfda685be5c8138d5b5d5c2366dc41665ef7064 (commit)
       via  ac5daf964a49edc00dc23c621cb5fbc6b9deca4e (commit)
       via  61d7cc52ebd5bcaf9676a285268e1dc8c1131908 (commit)
       via  c5800af1919ce735267f1dca4e0d9c5234ca9ce3 (commit)
       via  dffcc796ef7759fcb6bdfad7c576adc88e60a7ca (commit)
       via  c12c7f35633c1b75e4ed2c84e021065fce82716d (commit)
       via  8312fd5c1f82d5acc600c9d796ff99620cbbd3e1 (commit)
      from  1991df2f67e587f01de2836f09015fc1983d1a45 (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=742fcc25999fa30d348dc6df35cd07ecbdcb6fe9
commit 742fcc25999fa30d348dc6df35cd07ecbdcb6fe9
Merge: 1991df2 b57b787
Author:     Stephen Kelly <steve...@gmail.com>
AuthorDate: Sat Oct 8 16:00:36 2016 -0400
Commit:     CMake Topic Stage <kwro...@kitware.com>
CommitDate: Sat Oct 8 16:00:36 2016 -0400

    Merge topic 'extract-cmLinkLineComputer' into next
    
    b57b7870 cmLinkLineComputer: Extract link libraries computation from 
cmLocalGenerator
    076d3992 cmLinkLineComputer: Move FrameworkPath computation from 
cmLocalGenerator
    b0661505 cmLocalGenerator: Inline last use of local variable
    7a7a0219 cmLinkLineComputer: Move RPath computation from cmLocalGenerator
    639cbcda cmLinkLineComputer: Move LinkPath computation from cmLocalGenerator
    62e5fc1d cmLinkLineComputer: Move ComputeLinkLibs from cmLocalGenerator
    37cab7eb cmLocalGenerator: Move variable to where it is used
    0e16f8f8 cmLocalGenerator: Use a std::string instead of char*
    47e6e46f cmLocalGenerator: Move stringstream to where it is used
    2f81fb21 cmLocalGenerator: Move flag determination up in the function
    cc911145 cmLocalGenerator: Separate stdlib content from library stream
    2bfda685 cmLocalGenerator: Separate rpath content from library stream
    ac5daf96 cmLocalGenerator: Pass link library info to OutputLinkLibraries
    61d7cc52 Makefiles: Port CreateLinkLibs to cmLinkLineComputer
    c5800af1 cmLinkLineComputer: Extract from cmLocalGenerator
    dffcc796 Ninja: Constify
    ...


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b57b7870f6e188136ec0bae6ebc555c882feee90
commit b57b7870f6e188136ec0bae6ebc555c882feee90
Author:     Stephen Kelly <steve...@gmail.com>
AuthorDate: Sat Oct 8 12:21:39 2016 +0200
Commit:     Stephen Kelly <steve...@gmail.com>
CommitDate: Sat Oct 8 13:47:24 2016 +0200

    cmLinkLineComputer: Extract link libraries computation from cmLocalGenerator
    
    Hide some methods which no longer need to be public.

diff --git a/Source/cmLinkLineComputer.cxx b/Source/cmLinkLineComputer.cxx
index 41096ef..24f3578 100644
--- a/Source/cmLinkLineComputer.cxx
+++ b/Source/cmLinkLineComputer.cxx
@@ -152,3 +152,28 @@ std::string cmLinkLineComputer::ComputeFrameworkPath(
   }
   return frameworkPath;
 }
+
+std::string cmLinkLineComputer::ComputeLinkLibraries(
+  cmComputeLinkInformation& cli, std::string const& stdLibString)
+{
+  std::ostringstream fout;
+  fout << this->ComputeRPath(cli);
+
+  // Write the library flags to the build rule.
+  fout << this->ComputeLinkLibs(cli);
+
+  // Add the linker runtime search path if any.
+  std::string rpath_link = cli.GetRPathLinkString();
+  if (!cli.GetRPathLinkFlag().empty() && !rpath_link.empty()) {
+    fout << cli.GetRPathLinkFlag();
+    fout << this->OutputConverter->EscapeForShell(rpath_link,
+                                                  !this->ForResponse);
+    fout << " ";
+  }
+
+  if (!stdLibString.empty()) {
+    fout << stdLibString << " ";
+  }
+
+  return fout.str();
+}
diff --git a/Source/cmLinkLineComputer.h b/Source/cmLinkLineComputer.h
index f72368a..1fb9b24 100644
--- a/Source/cmLinkLineComputer.h
+++ b/Source/cmLinkLineComputer.h
@@ -22,18 +22,20 @@ public:
 
   virtual std::string ConvertToLinkReference(std::string const& input) const;
 
-  std::string ComputeLinkLibs(cmComputeLinkInformation& cli);
-
   std::string ComputeLinkPath(cmComputeLinkInformation& cli,
                               std::string const& libPathFlag,
                               std::string const& libPathTerminator);
 
-  std::string ComputeRPath(cmComputeLinkInformation& cli);
-
   std::string ComputeFrameworkPath(cmComputeLinkInformation& cli,
                                    std::string const& fwSearchFlag);
 
+  std::string ComputeLinkLibraries(cmComputeLinkInformation& cli,
+                                   std::string const& stdLibString);
+
 private:
+  std::string ComputeLinkLibs(cmComputeLinkInformation& cli);
+  std::string ComputeRPath(cmComputeLinkInformation& cli);
+
   std::string ConvertToOutputFormat(std::string const& input);
   std::string ConvertToOutputForExisting(std::string const& input);
 
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 9072445..c45ff7e 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1206,7 +1206,7 @@ void cmLocalGenerator::GetTargetFlags(
       }
       if (pcli) {
         this->OutputLinkLibraries(pcli, linkLineComputer, linkLibs,
-                                  frameworkPath, linkPath, false);
+                                  frameworkPath, linkPath);
       }
     } break;
     case cmState::EXECUTABLE: {
@@ -1228,7 +1228,7 @@ void cmLocalGenerator::GetTargetFlags(
       this->AddLanguageFlags(flags, linkLanguage, buildType);
       if (!pcli) {
         this->OutputLinkLibraries(pcli, linkLineComputer, linkLibs,
-                                  frameworkPath, linkPath, false);
+                                  frameworkPath, linkPath);
       }
       if (cmSystemTools::IsOn(
             this->Makefile->GetDefinition("BUILD_SHARED_LIBS"))) {
@@ -1396,7 +1396,7 @@ std::string cmLocalGenerator::GetTargetFortranFlags(
 void cmLocalGenerator::OutputLinkLibraries(
   cmComputeLinkInformation* pcli, cmLinkLineComputer* linkLineComputer,
   std::string& linkLibraries, std::string& frameworkPath,
-  std::string& linkPath, bool forResponseFile)
+  std::string& linkPath)
 {
   cmComputeLinkInformation& cli = *pcli;
 
@@ -1427,29 +1427,7 @@ void cmLocalGenerator::OutputLinkLibraries(
   linkPath =
     linkLineComputer->ComputeLinkPath(cli, libPathFlag, libPathTerminator);
 
-  std::string linkLibs = linkLineComputer->ComputeLinkLibs(cli);
-
-  std::string rpath = linkLineComputer->ComputeRPath(cli);
-
-  std::ostringstream fout;
-  fout << rpath;
-
-  // Write the library flags to the build rule.
-  fout << linkLibs;
-
-  // Add the linker runtime search path if any.
-  std::string rpath_link = cli.GetRPathLinkString();
-  if (!cli.GetRPathLinkFlag().empty() && !rpath_link.empty()) {
-    fout << cli.GetRPathLinkFlag();
-    fout << this->EscapeForShell(rpath_link, !forResponseFile);
-    fout << " ";
-  }
-
-  if (!stdLibString.empty()) {
-    fout << stdLibString << " ";
-  }
-
-  linkLibraries = fout.str();
+  linkLibraries = linkLineComputer->ComputeLinkLibraries(cli, stdLibString);
 }
 
 std::string cmLocalGenerator::GetLinkLibsCMP0065(
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 4729acb..69c4101 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -351,8 +351,7 @@ protected:
   void OutputLinkLibraries(cmComputeLinkInformation* pcli,
                            cmLinkLineComputer* linkLineComputer,
                            std::string& linkLibraries,
-                           std::string& frameworkPath, std::string& linkPath,
-                           bool forResponseFile);
+                           std::string& frameworkPath, std::string& linkPath);
 
   // Expand rule variables in CMake of the type found in language rules
   void ExpandRuleVariables(std::string& string,
diff --git a/Source/cmMakefileTargetGenerator.cxx 
b/Source/cmMakefileTargetGenerator.cxx
index 61c4bfb..29df0a0 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -1605,8 +1605,7 @@ void cmMakefileTargetGenerator::CreateLinkLibs(
   cmComputeLinkInformation* pcli =
     this->GeneratorTarget->GetLinkInformation(config);
   this->LocalGenerator->OutputLinkLibraries(pcli, linkLineComputer, linkLibs,
-                                            frameworkPath, linkPath,
-                                            useResponseFile);
+                                            frameworkPath, linkPath);
   linkLibs = frameworkPath + linkPath + linkLibs;
 
   if (useResponseFile && linkLibs.find_first_not_of(' ') != linkLibs.npos) {

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=076d39926f899f88e30b4128c2c835ab35091a31
commit 076d39926f899f88e30b4128c2c835ab35091a31
Author:     Stephen Kelly <steve...@gmail.com>
AuthorDate: Sat Oct 8 12:21:39 2016 +0200
Commit:     Stephen Kelly <steve...@gmail.com>
CommitDate: Sat Oct 8 13:47:21 2016 +0200

    cmLinkLineComputer: Move FrameworkPath computation from cmLocalGenerator
    
    Add UseWatcomQuote state, and remove corresponding method parameters.

diff --git a/Source/cmGhsMultiTargetGenerator.cxx 
b/Source/cmGhsMultiTargetGenerator.cxx
index 67b5913..acf06e4 100644
--- a/Source/cmGhsMultiTargetGenerator.cxx
+++ b/Source/cmGhsMultiTargetGenerator.cxx
@@ -366,10 +366,11 @@ void cmGhsMultiTargetGenerator::WriteTargetLinkLibraries(
       this->LocalGenerator,
       this->GetGlobalGenerator()->CreateLinkLineComputer(
         this->LocalGenerator->GetStateSnapshot().GetDirectory()));
+    linkLineComputer->SetUseWatcomQuote(useWatcomQuote);
 
     this->LocalGenerator->GetTargetFlags(
       linkLineComputer.get(), config, linkLibraries, flags, linkFlags,
-      frameworkPath, linkPath, this->GeneratorTarget, useWatcomQuote);
+      frameworkPath, linkPath, this->GeneratorTarget);
     linkFlags = cmSystemTools::TrimWhitespace(linkFlags);
 
     if (!linkPath.empty()) {
diff --git a/Source/cmLinkLineComputer.cxx b/Source/cmLinkLineComputer.cxx
index 3675887..41096ef 100644
--- a/Source/cmLinkLineComputer.cxx
+++ b/Source/cmLinkLineComputer.cxx
@@ -136,3 +136,19 @@ std::string 
cmLinkLineComputer::ComputeRPath(cmComputeLinkInformation& cli)
   }
   return rpath;
 }
+
+std::string cmLinkLineComputer::ComputeFrameworkPath(
+  cmComputeLinkInformation& cli, std::string const& fwSearchFlag)
+{
+  std::string frameworkPath;
+  if (!fwSearchFlag.empty()) {
+    std::vector<std::string> const& fwDirs = cli.GetFrameworkPaths();
+    for (std::vector<std::string>::const_iterator fdi = fwDirs.begin();
+         fdi != fwDirs.end(); ++fdi) {
+      frameworkPath += fwSearchFlag;
+      frameworkPath += this->ConvertToOutputFormat(*fdi);
+      frameworkPath += " ";
+    }
+  }
+  return frameworkPath;
+}
diff --git a/Source/cmLinkLineComputer.h b/Source/cmLinkLineComputer.h
index d33e832..f72368a 100644
--- a/Source/cmLinkLineComputer.h
+++ b/Source/cmLinkLineComputer.h
@@ -30,6 +30,9 @@ public:
 
   std::string ComputeRPath(cmComputeLinkInformation& cli);
 
+  std::string ComputeFrameworkPath(cmComputeLinkInformation& cli,
+                                   std::string const& fwSearchFlag);
+
 private:
   std::string ConvertToOutputFormat(std::string const& input);
   std::string ConvertToOutputForExisting(std::string const& input);
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 99755f4..9072445 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1151,8 +1151,7 @@ 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)
+  std::string& frameworkPath, std::string& linkPath, cmGeneratorTarget* target)
 {
   const std::string buildType = cmSystemTools::UpperCase(config);
   cmComputeLinkInformation* pcli = target->GetLinkInformation(config);
@@ -1207,8 +1206,7 @@ void cmLocalGenerator::GetTargetFlags(
       }
       if (pcli) {
         this->OutputLinkLibraries(pcli, linkLineComputer, linkLibs,
-                                  frameworkPath, linkPath, false,
-                                  useWatcomQuote);
+                                  frameworkPath, linkPath, false);
       }
     } break;
     case cmState::EXECUTABLE: {
@@ -1230,8 +1228,7 @@ void cmLocalGenerator::GetTargetFlags(
       this->AddLanguageFlags(flags, linkLanguage, buildType);
       if (!pcli) {
         this->OutputLinkLibraries(pcli, linkLineComputer, linkLibs,
-                                  frameworkPath, linkPath, false,
-                                  useWatcomQuote);
+                                  frameworkPath, linkPath, false);
       }
       if (cmSystemTools::IsOn(
             this->Makefile->GetDefinition("BUILD_SHARED_LIBS"))) {
@@ -1399,10 +1396,8 @@ std::string cmLocalGenerator::GetTargetFortranFlags(
 void cmLocalGenerator::OutputLinkLibraries(
   cmComputeLinkInformation* pcli, cmLinkLineComputer* linkLineComputer,
   std::string& linkLibraries, std::string& frameworkPath,
-  std::string& linkPath, bool forResponseFile, bool useWatcomQuote)
+  std::string& linkPath, bool forResponseFile)
 {
-  OutputFormat shellFormat =
-    (forResponseFile) ? RESPONSE : ((useWatcomQuote) ? WATCOMQUOTE : SHELL);
   cmComputeLinkInformation& cli = *pcli;
 
   std::string linkLanguage = cli.GetLinkLanguage();
@@ -1427,16 +1422,8 @@ void cmLocalGenerator::OutputLinkLibraries(
   fwSearchFlagVar += "_FRAMEWORK_SEARCH_FLAG";
   std::string fwSearchFlag =
     this->Makefile->GetSafeDefinition(fwSearchFlagVar);
-  if (!fwSearchFlag.empty()) {
-    std::vector<std::string> const& fwDirs = cli.GetFrameworkPaths();
-    for (std::vector<std::string>::const_iterator fdi = fwDirs.begin();
-         fdi != fwDirs.end(); ++fdi) {
-      frameworkPath += fwSearchFlag;
-      frameworkPath += this->ConvertToOutputFormat(*fdi, shellFormat);
-      frameworkPath += " ";
-    }
-  }
 
+  frameworkPath = linkLineComputer->ComputeFrameworkPath(cli, fwSearchFlag);
   linkPath =
     linkLineComputer->ComputeLinkPath(cli, libPathFlag, libPathTerminator);
 
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 75e01cb..4729acb 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -318,7 +318,7 @@ public:
                       const std::string& config, std::string& linkLibs,
                       std::string& flags, std::string& linkFlags,
                       std::string& frameworkPath, std::string& linkPath,
-                      cmGeneratorTarget* target, bool useWatcomQuote);
+                      cmGeneratorTarget* target);
   void GetTargetDefines(cmGeneratorTarget const* target,
                         std::string const& config, std::string const& lang,
                         std::set<std::string>& defines) const;
@@ -352,7 +352,7 @@ protected:
                            cmLinkLineComputer* linkLineComputer,
                            std::string& linkLibraries,
                            std::string& frameworkPath, std::string& linkPath,
-                           bool forResponseFile, bool useWatcomQuote);
+                           bool forResponseFile);
 
   // Expand rule variables in CMake of the type found in language rules
   void ExpandRuleVariables(std::string& string,
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx 
b/Source/cmMakefileExecutableTargetGenerator.cxx
index f17e012..bfc4857 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -315,7 +315,7 @@ void 
cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
     // Collect up flags to link in needed libraries.
     std::string linkLibs;
     this->CreateLinkLibs(linkLineComputer.get(), linkLibs,
-                         useResponseFileForLibs, depends, useWatcomQuote);
+                         useResponseFileForLibs, depends);
 
     // Construct object file lists that may be needed to expand the
     // rule.
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx 
b/Source/cmMakefileLibraryTargetGenerator.cxx
index e0934b5..4488f06 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -514,7 +514,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
       linkLineComputer->SetRelink(relink);
 
       this->CreateLinkLibs(linkLineComputer.get(), linkLibs,
-                           useResponseFileForLibs, depends, useWatcomQuote);
+                           useResponseFileForLibs, depends);
     }
 
     // Construct object file lists that may be needed to expand the
diff --git a/Source/cmMakefileTargetGenerator.cxx 
b/Source/cmMakefileTargetGenerator.cxx
index a09318f..61c4bfb 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -1597,8 +1597,7 @@ cmLinkLineComputer* 
cmMakefileTargetGenerator::CreateLinkLineComputer(
 
 void cmMakefileTargetGenerator::CreateLinkLibs(
   cmLinkLineComputer* linkLineComputer, std::string& linkLibs,
-  bool useResponseFile, std::vector<std::string>& makefile_depends,
-  bool useWatcomQuote)
+  bool useResponseFile, std::vector<std::string>& makefile_depends)
 {
   std::string frameworkPath;
   std::string linkPath;
@@ -1607,7 +1606,7 @@ void cmMakefileTargetGenerator::CreateLinkLibs(
     this->GeneratorTarget->GetLinkInformation(config);
   this->LocalGenerator->OutputLinkLibraries(pcli, linkLineComputer, linkLibs,
                                             frameworkPath, linkPath,
-                                            useResponseFile, useWatcomQuote);
+                                            useResponseFile);
   linkLibs = frameworkPath + linkPath + linkLibs;
 
   if (useResponseFile && linkLibs.find_first_not_of(' ') != linkLibs.npos) {
diff --git a/Source/cmMakefileTargetGenerator.h 
b/Source/cmMakefileTargetGenerator.h
index b7d7837..69d9d28 100644
--- a/Source/cmMakefileTargetGenerator.h
+++ b/Source/cmMakefileTargetGenerator.h
@@ -156,8 +156,7 @@ protected:
   /** Create list of flags for link libraries. */
   void CreateLinkLibs(cmLinkLineComputer* linkLineComputer,
                       std::string& linkLibs, bool useResponseFile,
-                      std::vector<std::string>& makefile_depends,
-                      bool useWatcomQuote);
+                      std::vector<std::string>& makefile_depends);
 
   /** Create lists of object files for linking and cleaning.  */
   void CreateObjectLists(bool useLinkScript, bool useArchiveRules,
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx 
b/Source/cmNinjaNormalTargetGenerator.cxx
index a458bbb..ab086eb 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -475,11 +475,11 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
     this->GetGlobalGenerator()->CreateLinkLineComputer(
       this->GetLocalGenerator(),
       this->GetLocalGenerator()->GetStateSnapshot().GetDirectory()));
+  linkLineComputer->SetUseWatcomQuote(useWatcomQuote);
 
-  localGen.GetTargetFlags(linkLineComputer.get(), this->GetConfigName(),
-                          vars["LINK_LIBRARIES"], vars["FLAGS"],
-                          vars["LINK_FLAGS"], frameworkPath, linkPath,
-                          &genTarget, useWatcomQuote);
+  localGen.GetTargetFlags(
+    linkLineComputer.get(), this->GetConfigName(), vars["LINK_LIBRARIES"],
+    vars["FLAGS"], vars["LINK_FLAGS"], frameworkPath, linkPath, &genTarget);
   if (this->GetMakefile()->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS") &&
       (gt.GetType() == cmState::SHARED_LIBRARY ||
        gt.IsExecutableWithExports())) {
diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx
index d537cfd..e0fcb75 100644
--- a/Source/cmServerProtocol.cxx
+++ b/Source/cmServerProtocol.cxx
@@ -732,7 +732,7 @@ static Json::Value DumpTarget(cmGeneratorTarget* target,
     cmLinkLineComputer linkLineComputer(lg,
                                         lg->GetStateSnapshot().GetDirectory());
     lg->GetTargetFlags(&linkLineComputer, config, linkLibs, linkLanguageFlags,
-                       linkFlags, frameworkPath, linkPath, target, false);
+                       linkFlags, frameworkPath, linkPath, target);
 
     linkLibs = cmSystemTools::TrimWhitespace(linkLibs);
     linkFlags = cmSystemTools::TrimWhitespace(linkFlags);
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 6a7dee3..e400c35 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -586,7 +586,7 @@ bool cmake::FindPackage(const std::vector<std::string>& 
args)
     cmLinkLineComputer linkLineComputer(lg,
                                         lg->GetStateSnapshot().GetDirectory());
     lg->GetTargetFlags(&linkLineComputer, buildType, linkLibs, flags,
-                       linkFlags, frameworkPath, linkPath, gtgt, false);
+                       linkFlags, frameworkPath, linkPath, gtgt);
     linkLibs = frameworkPath + linkPath + linkLibs;
 
     printf("%s\n", linkLibs.c_str());

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b06615050293a04b7e7ef8ccf97ec706351d761e
commit b06615050293a04b7e7ef8ccf97ec706351d761e
Author:     Stephen Kelly <steve...@gmail.com>
AuthorDate: Sat Oct 8 12:21:38 2016 +0200
Commit:     Stephen Kelly <steve...@gmail.com>
CommitDate: Sat Oct 8 13:30:28 2016 +0200

    cmLocalGenerator: Inline last use of local variable

diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index b68d35f..99755f4 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1403,8 +1403,6 @@ void cmLocalGenerator::OutputLinkLibraries(
 {
   OutputFormat shellFormat =
     (forResponseFile) ? RESPONSE : ((useWatcomQuote) ? WATCOMQUOTE : SHELL);
-  bool escapeAllowMakeVars = !forResponseFile;
-
   cmComputeLinkInformation& cli = *pcli;
 
   std::string linkLanguage = cli.GetLinkLanguage();
@@ -1456,7 +1454,7 @@ void cmLocalGenerator::OutputLinkLibraries(
   std::string rpath_link = cli.GetRPathLinkString();
   if (!cli.GetRPathLinkFlag().empty() && !rpath_link.empty()) {
     fout << cli.GetRPathLinkFlag();
-    fout << this->EscapeForShell(rpath_link, escapeAllowMakeVars);
+    fout << this->EscapeForShell(rpath_link, !forResponseFile);
     fout << " ";
   }
 

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7a7a02193745d52183cdd203deb1a93d49f797e7
commit 7a7a02193745d52183cdd203deb1a93d49f797e7
Author:     Stephen Kelly <steve...@gmail.com>
AuthorDate: Sat Oct 8 12:21:38 2016 +0200
Commit:     Stephen Kelly <steve...@gmail.com>
CommitDate: Sat Oct 8 13:30:28 2016 +0200

    cmLinkLineComputer: Move RPath computation from cmLocalGenerator
    
    Add state for Relink and populate it at the point of cmLinkLineComputer
    initialization.  This allows removal of the parameter in go-between
    methods.

diff --git a/Source/cmLinkLineComputer.cxx b/Source/cmLinkLineComputer.cxx
index a5e8b72..3675887 100644
--- a/Source/cmLinkLineComputer.cxx
+++ b/Source/cmLinkLineComputer.cxx
@@ -12,6 +12,7 @@ cmLinkLineComputer::cmLinkLineComputer(cmOutputConverter* 
outputConverter,
   , OutputConverter(outputConverter)
   , ForResponse(false)
   , UseWatcomQuote(false)
+  , Relink(false)
 {
 }
 
@@ -29,6 +30,11 @@ void cmLinkLineComputer::SetForResponse(bool forResponse)
   this->ForResponse = forResponse;
 }
 
+void cmLinkLineComputer::SetRelink(bool relink)
+{
+  this->Relink = relink;
+}
+
 std::string cmLinkLineComputer::ConvertToLinkReference(
   std::string const& lib) const
 {
@@ -100,3 +106,33 @@ std::string cmLinkLineComputer::ComputeLinkPath(
   }
   return linkPath;
 }
+
+std::string cmLinkLineComputer::ComputeRPath(cmComputeLinkInformation& cli)
+{
+  std::string rpath;
+  // Check what kind of rpath flags to use.
+  if (cli.GetRuntimeSep().empty()) {
+    // Each rpath entry gets its own option ("-R a -R b -R c")
+    std::vector<std::string> runtimeDirs;
+    cli.GetRPath(runtimeDirs, this->Relink);
+
+    for (std::vector<std::string>::iterator ri = runtimeDirs.begin();
+         ri != runtimeDirs.end(); ++ri) {
+      rpath += cli.GetRuntimeFlag();
+      rpath += this->ConvertToOutputFormat(*ri);
+      rpath += " ";
+    }
+  } else {
+    // All rpath entries are combined ("-Wl,-rpath,a:b:c").
+    std::string rpathString = cli.GetRPathString(this->Relink);
+
+    // Store the rpath option in the stream.
+    if (!rpathString.empty()) {
+      rpath += cli.GetRuntimeFlag();
+      rpath +=
+        this->OutputConverter->EscapeForShell(rpathString, !this->ForResponse);
+      rpath += " ";
+    }
+  }
+  return rpath;
+}
diff --git a/Source/cmLinkLineComputer.h b/Source/cmLinkLineComputer.h
index d38213f..d33e832 100644
--- a/Source/cmLinkLineComputer.h
+++ b/Source/cmLinkLineComputer.h
@@ -18,6 +18,7 @@ public:
 
   void SetUseWatcomQuote(bool useWatcomQuote);
   void SetForResponse(bool forResponse);
+  void SetRelink(bool relink);
 
   virtual std::string ConvertToLinkReference(std::string const& input) const;
 
@@ -27,6 +28,8 @@ public:
                               std::string const& libPathFlag,
                               std::string const& libPathTerminator);
 
+  std::string ComputeRPath(cmComputeLinkInformation& cli);
+
 private:
   std::string ConvertToOutputFormat(std::string const& input);
   std::string ConvertToOutputForExisting(std::string const& input);
@@ -36,6 +39,7 @@ private:
 
   bool ForResponse;
   bool UseWatcomQuote;
+  bool Relink;
 };
 
 #endif
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index cbf1d1a..b68d35f 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1207,7 +1207,7 @@ void cmLocalGenerator::GetTargetFlags(
       }
       if (pcli) {
         this->OutputLinkLibraries(pcli, linkLineComputer, linkLibs,
-                                  frameworkPath, linkPath, false, false,
+                                  frameworkPath, linkPath, false,
                                   useWatcomQuote);
       }
     } break;
@@ -1230,7 +1230,7 @@ void cmLocalGenerator::GetTargetFlags(
       this->AddLanguageFlags(flags, linkLanguage, buildType);
       if (!pcli) {
         this->OutputLinkLibraries(pcli, linkLineComputer, linkLibs,
-                                  frameworkPath, linkPath, false, false,
+                                  frameworkPath, linkPath, false,
                                   useWatcomQuote);
       }
       if (cmSystemTools::IsOn(
@@ -1399,8 +1399,7 @@ std::string cmLocalGenerator::GetTargetFortranFlags(
 void cmLocalGenerator::OutputLinkLibraries(
   cmComputeLinkInformation* pcli, cmLinkLineComputer* linkLineComputer,
   std::string& linkLibraries, std::string& frameworkPath,
-  std::string& linkPath, bool relink, bool forResponseFile,
-  bool useWatcomQuote)
+  std::string& linkPath, bool forResponseFile, bool useWatcomQuote)
 {
   OutputFormat shellFormat =
     (forResponseFile) ? RESPONSE : ((useWatcomQuote) ? WATCOMQUOTE : SHELL);
@@ -1445,31 +1444,7 @@ void cmLocalGenerator::OutputLinkLibraries(
 
   std::string linkLibs = linkLineComputer->ComputeLinkLibs(cli);
 
-  std::string rpath;
-
-  // Check what kind of rpath flags to use.
-  if (cli.GetRuntimeSep().empty()) {
-    // Each rpath entry gets its own option ("-R a -R b -R c")
-    std::vector<std::string> runtimeDirs;
-    cli.GetRPath(runtimeDirs, relink);
-
-    for (std::vector<std::string>::iterator ri = runtimeDirs.begin();
-         ri != runtimeDirs.end(); ++ri) {
-      rpath += cli.GetRuntimeFlag();
-      rpath += this->ConvertToOutputFormat(*ri, shellFormat);
-      rpath += " ";
-    }
-  } else {
-    // All rpath entries are combined ("-Wl,-rpath,a:b:c").
-    std::string rpathString = cli.GetRPathString(relink);
-
-    // Store the rpath option in the stream.
-    if (!rpathString.empty()) {
-      rpath += cli.GetRuntimeFlag();
-      rpath += this->EscapeForShell(rpathString, escapeAllowMakeVars);
-      rpath += " ";
-    }
-  }
+  std::string rpath = linkLineComputer->ComputeRPath(cli);
 
   std::ostringstream fout;
   fout << rpath;
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 12b2b69..75e01cb 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -352,8 +352,7 @@ protected:
                            cmLinkLineComputer* linkLineComputer,
                            std::string& linkLibraries,
                            std::string& frameworkPath, std::string& linkPath,
-                           bool relink, bool forResponseFile,
-                           bool useWatcomQuote);
+                           bool forResponseFile, bool useWatcomQuote);
 
   // Expand rule variables in CMake of the type found in language rules
   void ExpandRuleVariables(std::string& string,
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx 
b/Source/cmMakefileExecutableTargetGenerator.cxx
index eaa5061..f17e012 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -310,10 +310,11 @@ void 
cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
         this->LocalGenerator->GetStateSnapshot().GetDirectory()));
     linkLineComputer->SetForResponse(useResponseFileForLibs);
     linkLineComputer->SetUseWatcomQuote(useWatcomQuote);
+    linkLineComputer->SetRelink(relink);
 
     // Collect up flags to link in needed libraries.
     std::string linkLibs;
-    this->CreateLinkLibs(linkLineComputer.get(), linkLibs, relink,
+    this->CreateLinkLibs(linkLineComputer.get(), linkLibs,
                          useResponseFileForLibs, depends, useWatcomQuote);
 
     // Construct object file lists that may be needed to expand the
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx 
b/Source/cmMakefileLibraryTargetGenerator.cxx
index ccc6d9f..e0934b5 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -511,8 +511,9 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
           this->LocalGenerator->GetStateSnapshot().GetDirectory()));
       linkLineComputer->SetForResponse(useResponseFileForLibs);
       linkLineComputer->SetUseWatcomQuote(useWatcomQuote);
+      linkLineComputer->SetRelink(relink);
 
-      this->CreateLinkLibs(linkLineComputer.get(), linkLibs, relink,
+      this->CreateLinkLibs(linkLineComputer.get(), linkLibs,
                            useResponseFileForLibs, depends, useWatcomQuote);
     }
 
diff --git a/Source/cmMakefileTargetGenerator.cxx 
b/Source/cmMakefileTargetGenerator.cxx
index c44af0b..a09318f 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -1596,7 +1596,7 @@ cmLinkLineComputer* 
cmMakefileTargetGenerator::CreateLinkLineComputer(
 }
 
 void cmMakefileTargetGenerator::CreateLinkLibs(
-  cmLinkLineComputer* linkLineComputer, std::string& linkLibs, bool relink,
+  cmLinkLineComputer* linkLineComputer, std::string& linkLibs,
   bool useResponseFile, std::vector<std::string>& makefile_depends,
   bool useWatcomQuote)
 {
@@ -1606,7 +1606,7 @@ void cmMakefileTargetGenerator::CreateLinkLibs(
   cmComputeLinkInformation* pcli =
     this->GeneratorTarget->GetLinkInformation(config);
   this->LocalGenerator->OutputLinkLibraries(pcli, linkLineComputer, linkLibs,
-                                            frameworkPath, linkPath, relink,
+                                            frameworkPath, linkPath,
                                             useResponseFile, useWatcomQuote);
   linkLibs = frameworkPath + linkPath + linkLibs;
 
diff --git a/Source/cmMakefileTargetGenerator.h 
b/Source/cmMakefileTargetGenerator.h
index 4913ba8..b7d7837 100644
--- a/Source/cmMakefileTargetGenerator.h
+++ b/Source/cmMakefileTargetGenerator.h
@@ -155,7 +155,7 @@ protected:
 
   /** Create list of flags for link libraries. */
   void CreateLinkLibs(cmLinkLineComputer* linkLineComputer,
-                      std::string& linkLibs, bool relink, bool useResponseFile,
+                      std::string& linkLibs, bool useResponseFile,
                       std::vector<std::string>& makefile_depends,
                       bool useWatcomQuote);
 

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=639cbcdaf9e7dc5ae9e4156ec2f21ad1c8634acf
commit 639cbcdaf9e7dc5ae9e4156ec2f21ad1c8634acf
Author:     Stephen Kelly <steve...@gmail.com>
AuthorDate: Sat Oct 8 12:21:38 2016 +0200
Commit:     Stephen Kelly <steve...@gmail.com>
CommitDate: Sat Oct 8 13:30:28 2016 +0200

    cmLinkLineComputer: Move LinkPath computation from cmLocalGenerator
    
    Add a ConvertToOutputForExisting method which can be made virtual later
    to satisfy different generator needs.
    
    Pass additional strings as parameters for now.  They can be turned into
    class state later.

diff --git a/Source/cmLinkLineComputer.cxx b/Source/cmLinkLineComputer.cxx
index b2b56bf..a5e8b72 100644
--- a/Source/cmLinkLineComputer.cxx
+++ b/Source/cmLinkLineComputer.cxx
@@ -72,3 +72,31 @@ std::string 
cmLinkLineComputer::ConvertToOutputFormat(std::string const& input)
 
   return this->OutputConverter->ConvertToOutputFormat(input, shellFormat);
 }
+
+std::string cmLinkLineComputer::ConvertToOutputForExisting(
+  std::string const& input)
+{
+  cmOutputConverter::OutputFormat shellFormat = (this->ForResponse)
+    ? cmOutputConverter::RESPONSE
+    : ((this->UseWatcomQuote) ? cmOutputConverter::WATCOMQUOTE
+                              : cmOutputConverter::SHELL);
+
+  return this->OutputConverter->ConvertToOutputForExisting(input, shellFormat);
+}
+
+std::string cmLinkLineComputer::ComputeLinkPath(
+  cmComputeLinkInformation& cli, std::string const& libPathFlag,
+  std::string const& libPathTerminator)
+{
+  std::string linkPath;
+  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->ConvertToOutputForExisting(*libDir);
+    linkPath += " " + libPathFlag;
+    linkPath += libpath;
+    linkPath += libPathTerminator;
+    linkPath += " ";
+  }
+  return linkPath;
+}
diff --git a/Source/cmLinkLineComputer.h b/Source/cmLinkLineComputer.h
index 2317385..d38213f 100644
--- a/Source/cmLinkLineComputer.h
+++ b/Source/cmLinkLineComputer.h
@@ -23,8 +23,13 @@ public:
 
   std::string ComputeLinkLibs(cmComputeLinkInformation& cli);
 
+  std::string ComputeLinkPath(cmComputeLinkInformation& cli,
+                              std::string const& libPathFlag,
+                              std::string const& libPathTerminator);
+
 private:
   std::string ConvertToOutputFormat(std::string const& input);
+  std::string ConvertToOutputForExisting(std::string const& input);
 
   cmState::Directory StateDir;
   cmOutputConverter* OutputConverter;
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index bdbbb94..cbf1d1a 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1440,17 +1440,8 @@ void cmLocalGenerator::OutputLinkLibraries(
     }
   }
 
-  // Append the library search path flags.
-  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->ConvertToOutputForExisting(*libDir, shellFormat);
-    linkPath += " " + libPathFlag;
-    linkPath += libpath;
-    linkPath += libPathTerminator;
-    linkPath += " ";
-  }
+  linkPath =
+    linkLineComputer->ComputeLinkPath(cli, libPathFlag, libPathTerminator);
 
   std::string linkLibs = linkLineComputer->ComputeLinkLibs(cli);
 

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=62e5fc1dbf477bb2628dee9d2e9bf143609f441b
commit 62e5fc1dbf477bb2628dee9d2e9bf143609f441b
Author:     Stephen Kelly <steve...@gmail.com>
AuthorDate: Sat Oct 8 12:21:38 2016 +0200
Commit:     Stephen Kelly <steve...@gmail.com>
CommitDate: Sat Oct 8 13:30:25 2016 +0200

    cmLinkLineComputer: Move ComputeLinkLibs from cmLocalGenerator
    
    Add a cmOutputConverter to the cmLinkLineComputer and factory methods to
    facilitate shell escapes.
    
    Add state to the cmLinkLineComputer to record whether outputting for
    response files or for watcom, to satisfy the cmOutputConverter API.
    These are constant for the lifetime of the cmLinkLineComputer, even when
    its functionality is extended in the future.  This also keeps the
    signatures of cmLinkLineComputer relatively simple.
    
    Pass the cmComputeLinkInformation as a method parameter so that
    cmLinkLineComputer is free from target-specific state.  An instance
    should be usable for all targets in a directory.

diff --git a/Source/cmGhsMultiTargetGenerator.cxx 
b/Source/cmGhsMultiTargetGenerator.cxx
index 575ddab..67b5913 100644
--- a/Source/cmGhsMultiTargetGenerator.cxx
+++ b/Source/cmGhsMultiTargetGenerator.cxx
@@ -363,6 +363,7 @@ void cmGhsMultiTargetGenerator::WriteTargetLinkLibraries(
     bool useWatcomQuote =
       this->Makefile->IsOn(createRule + "_USE_WATCOM_QUOTE");
     CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
+      this->LocalGenerator,
       this->GetGlobalGenerator()->CreateLinkLineComputer(
         this->LocalGenerator->GetStateSnapshot().GetDirectory()));
 
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 2266e44..1aa6af1 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1415,15 +1415,15 @@ cmGlobalGenerator::CreateQtAutoGeneratorsTargets()
 }
 
 cmLinkLineComputer* cmGlobalGenerator::CreateLinkLineComputer(
-  cmState::Directory stateDir) const
+  cmOutputConverter* outputConverter, cmState::Directory stateDir) const
 {
-  return new cmLinkLineComputer(stateDir);
+  return new cmLinkLineComputer(outputConverter, stateDir);
 }
 
 cmLinkLineComputer* cmGlobalGenerator::CreateMSVC60LinkLineComputer(
-  cmState::Directory stateDir) const
+  cmOutputConverter* outputConverter, cmState::Directory stateDir) const
 {
-  return new cmMSVC60LinkLineComputer(stateDir);
+  return new cmMSVC60LinkLineComputer(outputConverter, stateDir);
 }
 
 void cmGlobalGenerator::FinalizeTargetCompileInfo()
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 126eb6f..38eaa76 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -36,6 +36,7 @@ class cmGeneratorTarget;
 class cmLocalGenerator;
 class cmLinkLineComputer;
 class cmMakefile;
+class cmOutputConverter;
 class cmake;
 
 /** \class cmGlobalGenerator
@@ -107,10 +108,10 @@ public:
   virtual void Generate();
 
   virtual cmLinkLineComputer* CreateLinkLineComputer(
-    cmState::Directory stateDir) const;
+    cmOutputConverter* outputConverter, cmState::Directory stateDir) const;
 
   cmLinkLineComputer* CreateMSVC60LinkLineComputer(
-    cmState::Directory stateDir) const;
+    cmOutputConverter* outputConverter, cmState::Directory stateDir) const;
 
   /**
    * Set/Get and Clear the enabled languages.
diff --git a/Source/cmGlobalNinjaGenerator.cxx 
b/Source/cmGlobalNinjaGenerator.cxx
index 65a1f25..67df038 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -66,9 +66,10 @@ void cmGlobalNinjaGenerator::WriteComment(std::ostream& os,
 }
 
 cmLinkLineComputer* cmGlobalNinjaGenerator::CreateLinkLineComputer(
-  cmState::Directory /* stateDir */) const
+  cmOutputConverter* outputConverter, cmState::Directory /* stateDir */) const
 {
   return new cmNinjaLinkLineComputer(
+    outputConverter,
     this->LocalGenerators[0]->GetStateSnapshot().GetDirectory(), this);
 }
 
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index 87faf45..6b77a2b 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -70,8 +70,9 @@ public:
   std::string EncodePath(const std::string& path);
   static std::string EncodeDepfileSpace(const std::string& path);
 
-  cmLinkLineComputer* CreateLinkLineComputer(cmState::Directory stateDir) const
-    CM_OVERRIDE;
+  cmLinkLineComputer* CreateLinkLineComputer(
+    cmOutputConverter* outputConverter,
+    cmState::Directory stateDir) const CM_OVERRIDE;
 
   /**
    * Write the given @a comment to the output stream @a os. It
diff --git a/Source/cmLinkLineComputer.cxx b/Source/cmLinkLineComputer.cxx
index 7103a5b..b2b56bf 100644
--- a/Source/cmLinkLineComputer.cxx
+++ b/Source/cmLinkLineComputer.cxx
@@ -2,10 +2,16 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 
 #include "cmLinkLineComputer.h"
+#include "cmComputeLinkInformation.h"
+#include "cmGeneratorTarget.h"
 #include "cmOutputConverter.h"
 
-cmLinkLineComputer::cmLinkLineComputer(cmState::Directory stateDir)
+cmLinkLineComputer::cmLinkLineComputer(cmOutputConverter* outputConverter,
+                                       cmState::Directory stateDir)
   : StateDir(stateDir)
+  , OutputConverter(outputConverter)
+  , ForResponse(false)
+  , UseWatcomQuote(false)
 {
 }
 
@@ -13,6 +19,16 @@ cmLinkLineComputer::~cmLinkLineComputer()
 {
 }
 
+void cmLinkLineComputer::SetUseWatcomQuote(bool useWatcomQuote)
+{
+  this->UseWatcomQuote = useWatcomQuote;
+}
+
+void cmLinkLineComputer::SetForResponse(bool forResponse)
+{
+  this->ForResponse = forResponse;
+}
+
 std::string cmLinkLineComputer::ConvertToLinkReference(
   std::string const& lib) const
 {
@@ -25,3 +41,34 @@ std::string cmLinkLineComputer::ConvertToLinkReference(
   }
   return relLib;
 }
+
+std::string cmLinkLineComputer::ComputeLinkLibs(cmComputeLinkInformation& cli)
+{
+  std::string linkLibs;
+  typedef cmComputeLinkInformation::ItemVector ItemVector;
+  ItemVector const& items = cli.GetItems();
+  for (ItemVector::const_iterator li = items.begin(); li != items.end();
+       ++li) {
+    if (li->Target && li->Target->GetType() == cmState::INTERFACE_LIBRARY) {
+      continue;
+    }
+    if (li->IsPath) {
+      linkLibs +=
+        this->ConvertToOutputFormat(this->ConvertToLinkReference(li->Value));
+    } else {
+      linkLibs += li->Value;
+    }
+    linkLibs += " ";
+  }
+  return linkLibs;
+}
+
+std::string cmLinkLineComputer::ConvertToOutputFormat(std::string const& input)
+{
+  cmOutputConverter::OutputFormat shellFormat = (this->ForResponse)
+    ? cmOutputConverter::RESPONSE
+    : ((this->UseWatcomQuote) ? cmOutputConverter::WATCOMQUOTE
+                              : cmOutputConverter::SHELL);
+
+  return this->OutputConverter->ConvertToOutputFormat(input, shellFormat);
+}
diff --git a/Source/cmLinkLineComputer.h b/Source/cmLinkLineComputer.h
index bd4c740..2317385 100644
--- a/Source/cmLinkLineComputer.h
+++ b/Source/cmLinkLineComputer.h
@@ -6,16 +6,31 @@
 
 #include "cmState.h"
 
+class cmComputeLinkInformation;
+class cmOutputConverter;
+
 class cmLinkLineComputer
 {
 public:
-  cmLinkLineComputer(cmState::Directory stateDir);
+  cmLinkLineComputer(cmOutputConverter* outputConverter,
+                     cmState::Directory stateDir);
   virtual ~cmLinkLineComputer();
 
+  void SetUseWatcomQuote(bool useWatcomQuote);
+  void SetForResponse(bool forResponse);
+
   virtual std::string ConvertToLinkReference(std::string const& input) const;
 
+  std::string ComputeLinkLibs(cmComputeLinkInformation& cli);
+
 private:
+  std::string ConvertToOutputFormat(std::string const& input);
+
   cmState::Directory StateDir;
+  cmOutputConverter* OutputConverter;
+
+  bool ForResponse;
+  bool UseWatcomQuote;
 };
 
 #endif
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 5606b3b..bdbbb94 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1452,24 +1452,7 @@ void cmLocalGenerator::OutputLinkLibraries(
     linkPath += " ";
   }
 
-  std::string linkLibs;
-
-  // Append the link items.
-  typedef cmComputeLinkInformation::ItemVector ItemVector;
-  ItemVector const& items = cli.GetItems();
-  for (ItemVector::const_iterator li = items.begin(); li != items.end();
-       ++li) {
-    if (li->Target && li->Target->GetType() == cmState::INTERFACE_LIBRARY) {
-      continue;
-    }
-    if (li->IsPath) {
-      linkLibs += this->ConvertToOutputFormat(
-        linkLineComputer->ConvertToLinkReference(li->Value), shellFormat);
-    } else {
-      linkLibs += li->Value;
-    }
-    linkLibs += " ";
-  }
+  std::string linkLibs = linkLineComputer->ComputeLinkLibs(cli);
 
   std::string rpath;
 
diff --git a/Source/cmMSVC60LinkLineComputer.cxx 
b/Source/cmMSVC60LinkLineComputer.cxx
index 89432ff..2b6df2a 100644
--- a/Source/cmMSVC60LinkLineComputer.cxx
+++ b/Source/cmMSVC60LinkLineComputer.cxx
@@ -5,8 +5,9 @@
 
 #include "cmSystemTools.h"
 
-cmMSVC60LinkLineComputer::cmMSVC60LinkLineComputer(cmState::Directory stateDir)
-  : cmLinkLineComputer(stateDir)
+cmMSVC60LinkLineComputer::cmMSVC60LinkLineComputer(
+  cmOutputConverter* outputConverter, cmState::Directory stateDir)
+  : cmLinkLineComputer(outputConverter, stateDir)
 {
 }
 
diff --git a/Source/cmMSVC60LinkLineComputer.h 
b/Source/cmMSVC60LinkLineComputer.h
index c159b61..ca9da31 100644
--- a/Source/cmMSVC60LinkLineComputer.h
+++ b/Source/cmMSVC60LinkLineComputer.h
@@ -9,7 +9,8 @@
 class cmMSVC60LinkLineComputer : public cmLinkLineComputer
 {
 public:
-  cmMSVC60LinkLineComputer(cmState::Directory stateDir);
+  cmMSVC60LinkLineComputer(cmOutputConverter* outputConverter,
+                           cmState::Directory stateDir);
 
   std::string ConvertToLinkReference(std::string const& input) const
     CM_OVERRIDE;
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx 
b/Source/cmMakefileExecutableTargetGenerator.cxx
index 09967ff..eaa5061 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -219,6 +219,7 @@ void 
cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
   {
     CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
       this->CreateLinkLineComputer(
+        this->LocalGenerator,
         this->LocalGenerator->GetStateSnapshot().GetDirectory()));
 
     this->AddModuleDefinitionFlag(linkLineComputer.get(), linkFlags);
@@ -305,7 +306,10 @@ void 
cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
 
     CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
       this->CreateLinkLineComputer(
+        this->LocalGenerator,
         this->LocalGenerator->GetStateSnapshot().GetDirectory()));
+    linkLineComputer->SetForResponse(useResponseFileForLibs);
+    linkLineComputer->SetUseWatcomQuote(useWatcomQuote);
 
     // Collect up flags to link in needed libraries.
     std::string linkLibs;
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx 
b/Source/cmMakefileLibraryTargetGenerator.cxx
index e32f3a7..ccc6d9f 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -163,6 +163,7 @@ void 
cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink)
 
   CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
     this->CreateLinkLineComputer(
+      this->LocalGenerator,
       this->LocalGenerator->GetStateSnapshot().GetDirectory()));
 
   this->AddModuleDefinitionFlag(linkLineComputer.get(), extraFlags);
@@ -193,6 +194,7 @@ void 
cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink)
 
   CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
     this->CreateLinkLineComputer(
+      this->LocalGenerator,
       this->LocalGenerator->GetStateSnapshot().GetDirectory()));
 
   this->AddModuleDefinitionFlag(linkLineComputer.get(), extraFlags);
@@ -505,7 +507,10 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
 
       CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
         this->CreateLinkLineComputer(
+          this->LocalGenerator,
           this->LocalGenerator->GetStateSnapshot().GetDirectory()));
+      linkLineComputer->SetForResponse(useResponseFileForLibs);
+      linkLineComputer->SetUseWatcomQuote(useWatcomQuote);
 
       this->CreateLinkLibs(linkLineComputer.get(), linkLibs, relink,
                            useResponseFileForLibs, depends, useWatcomQuote);
diff --git a/Source/cmMakefileTargetGenerator.cxx 
b/Source/cmMakefileTargetGenerator.cxx
index 974d62a..c44af0b 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -1585,12 +1585,14 @@ std::string 
cmMakefileTargetGenerator::CreateResponseFile(
 }
 
 cmLinkLineComputer* cmMakefileTargetGenerator::CreateLinkLineComputer(
-  cmState::Directory stateDir)
+  cmOutputConverter* outputConverter, cmState::Directory stateDir)
 {
   if (this->Makefile->IsOn("MSVC60")) {
-    return this->GlobalGenerator->CreateMSVC60LinkLineComputer(stateDir);
+    return this->GlobalGenerator->CreateMSVC60LinkLineComputer(outputConverter,
+                                                               stateDir);
   }
-  return this->GlobalGenerator->CreateLinkLineComputer(stateDir);
+  return this->GlobalGenerator->CreateLinkLineComputer(outputConverter,
+                                                       stateDir);
 }
 
 void cmMakefileTargetGenerator::CreateLinkLibs(
diff --git a/Source/cmMakefileTargetGenerator.h 
b/Source/cmMakefileTargetGenerator.h
index 48fdc2f..4913ba8 100644
--- a/Source/cmMakefileTargetGenerator.h
+++ b/Source/cmMakefileTargetGenerator.h
@@ -141,7 +141,8 @@ protected:
                         std::vector<std::string>& makefile_commands,
                         std::vector<std::string>& makefile_depends);
 
-  cmLinkLineComputer* CreateLinkLineComputer(cmState::Directory stateDir);
+  cmLinkLineComputer* CreateLinkLineComputer(
+    cmOutputConverter* outputConverter, 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
diff --git a/Source/cmNinjaLinkLineComputer.cxx 
b/Source/cmNinjaLinkLineComputer.cxx
index dd74238..3dcb20b 100644
--- a/Source/cmNinjaLinkLineComputer.cxx
+++ b/Source/cmNinjaLinkLineComputer.cxx
@@ -5,8 +5,9 @@
 #include "cmGlobalNinjaGenerator.h"
 
 cmNinjaLinkLineComputer::cmNinjaLinkLineComputer(
-  cmState::Directory stateDir, cmGlobalNinjaGenerator const* gg)
-  : cmLinkLineComputer(stateDir)
+  cmOutputConverter* outputConverter, cmState::Directory stateDir,
+  cmGlobalNinjaGenerator const* gg)
+  : cmLinkLineComputer(outputConverter, stateDir)
   , GG(gg)
 {
 }
diff --git a/Source/cmNinjaLinkLineComputer.h b/Source/cmNinjaLinkLineComputer.h
index d86f214..a108568 100644
--- a/Source/cmNinjaLinkLineComputer.h
+++ b/Source/cmNinjaLinkLineComputer.h
@@ -12,7 +12,8 @@ class cmGlobalNinjaGenerator;
 class cmNinjaLinkLineComputer : public cmLinkLineComputer
 {
 public:
-  cmNinjaLinkLineComputer(cmState::Directory stateDir,
+  cmNinjaLinkLineComputer(cmOutputConverter* outputConverter,
+                          cmState::Directory stateDir,
                           cmGlobalNinjaGenerator const* gg);
 
   std::string ConvertToLinkReference(std::string const& input) const
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx 
b/Source/cmNinjaNormalTargetGenerator.cxx
index 9c22353..a458bbb 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -473,7 +473,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
 
   CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
     this->GetGlobalGenerator()->CreateLinkLineComputer(
-      localGen.GetStateSnapshot().GetDirectory()));
+      this->GetLocalGenerator(),
+      this->GetLocalGenerator()->GetStateSnapshot().GetDirectory()));
 
   localGen.GetTargetFlags(linkLineComputer.get(), this->GetConfigName(),
                           vars["LINK_LIBRARIES"], vars["FLAGS"],
diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx
index a58510e..d537cfd 100644
--- a/Source/cmServerProtocol.cxx
+++ b/Source/cmServerProtocol.cxx
@@ -729,12 +729,10 @@ 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);
+    cmLinkLineComputer linkLineComputer(lg,
+                                        lg->GetStateSnapshot().GetDirectory());
+    lg->GetTargetFlags(&linkLineComputer, 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..6a7dee3 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -583,9 +583,9 @@ 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,
+    cmLinkLineComputer linkLineComputer(lg,
+                                        lg->GetStateSnapshot().GetDirectory());
+    lg->GetTargetFlags(&linkLineComputer, buildType, linkLibs, flags,
                        linkFlags, frameworkPath, linkPath, gtgt, false);
     linkLibs = frameworkPath + linkPath + linkLibs;
 

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=37cab7eb17b505a18f534408307797a5e126663e
commit 37cab7eb17b505a18f534408307797a5e126663e
Author:     Stephen Kelly <steve...@gmail.com>
AuthorDate: Sat Oct 8 12:21:37 2016 +0200
Commit:     Stephen Kelly <steve...@gmail.com>
CommitDate: Sat Oct 8 12:21:37 2016 +0200

    cmLocalGenerator: Move variable to where it is used

diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 07c8186..5606b3b 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1410,8 +1410,6 @@ void cmLocalGenerator::OutputLinkLibraries(
 
   std::string linkLanguage = cli.GetLinkLanguage();
 
-  std::string linkLibs;
-
   std::string libPathFlag =
     this->Makefile->GetRequiredDefinition("CMAKE_LIBRARY_PATH_FLAG");
   std::string libPathTerminator =
@@ -1454,6 +1452,8 @@ void cmLocalGenerator::OutputLinkLibraries(
     linkPath += " ";
   }
 
+  std::string linkLibs;
+
   // Append the link items.
   typedef cmComputeLinkInformation::ItemVector ItemVector;
   ItemVector const& items = cli.GetItems();

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0e16f8f8067ae721d23e842b83e0e24d4e5d2b49
commit 0e16f8f8067ae721d23e842b83e0e24d4e5d2b49
Author:     Stephen Kelly <steve...@gmail.com>
AuthorDate: Sat Oct 8 12:21:37 2016 +0200
Commit:     Stephen Kelly <steve...@gmail.com>
CommitDate: Sat Oct 8 12:21:37 2016 +0200

    cmLocalGenerator: Use a std::string instead of char*

diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 7b7495b..07c8186 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1430,8 +1430,9 @@ void cmLocalGenerator::OutputLinkLibraries(
   std::string fwSearchFlagVar = "CMAKE_";
   fwSearchFlagVar += linkLanguage;
   fwSearchFlagVar += "_FRAMEWORK_SEARCH_FLAG";
-  const char* fwSearchFlag = this->Makefile->GetDefinition(fwSearchFlagVar);
-  if (fwSearchFlag && *fwSearchFlag) {
+  std::string fwSearchFlag =
+    this->Makefile->GetSafeDefinition(fwSearchFlagVar);
+  if (!fwSearchFlag.empty()) {
     std::vector<std::string> const& fwDirs = cli.GetFrameworkPaths();
     for (std::vector<std::string>::const_iterator fdi = fwDirs.begin();
          fdi != fwDirs.end(); ++fdi) {

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=47e6e46fcf85e73b65b0f93be4e1d9aeb72b9579
commit 47e6e46fcf85e73b65b0f93be4e1d9aeb72b9579
Author:     Stephen Kelly <steve...@gmail.com>
AuthorDate: Sat Oct 8 12:21:37 2016 +0200
Commit:     Stephen Kelly <steve...@gmail.com>
CommitDate: Sat Oct 8 12:21:37 2016 +0200

    cmLocalGenerator: Move stringstream to where it is used

diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 4411b88..7b7495b 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1405,7 +1405,6 @@ void cmLocalGenerator::OutputLinkLibraries(
   OutputFormat shellFormat =
     (forResponseFile) ? RESPONSE : ((useWatcomQuote) ? WATCOMQUOTE : SHELL);
   bool escapeAllowMakeVars = !forResponseFile;
-  std::ostringstream fout;
 
   cmComputeLinkInformation& cli = *pcli;
 
@@ -1497,6 +1496,7 @@ void cmLocalGenerator::OutputLinkLibraries(
     }
   }
 
+  std::ostringstream fout;
   fout << rpath;
 
   // Write the library flags to the build rule.

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2f81fb21790dac9f6036d804d68f108bb498b720
commit 2f81fb21790dac9f6036d804d68f108bb498b720
Author:     Stephen Kelly <steve...@gmail.com>
AuthorDate: Sat Oct 8 12:21:37 2016 +0200
Commit:     Stephen Kelly <steve...@gmail.com>
CommitDate: Sat Oct 8 12:21:37 2016 +0200

    cmLocalGenerator: Move flag determination up in the function
    
    This content is independent of any targets.

diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index ee1d613..4411b88 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1418,6 +1418,15 @@ void cmLocalGenerator::OutputLinkLibraries(
   std::string libPathTerminator =
     this->Makefile->GetSafeDefinition("CMAKE_LIBRARY_PATH_TERMINATOR");
 
+  // Add standard libraries for this language.
+  std::string standardLibsVar = "CMAKE_";
+  standardLibsVar += cli.GetLinkLanguage();
+  standardLibsVar += "_STANDARD_LIBRARIES";
+  std::string stdLibString;
+  if (const char* stdLibs = this->Makefile->GetDefinition(standardLibsVar)) {
+    stdLibString = stdLibs;
+  }
+
   // Append the framework search path flags.
   std::string fwSearchFlagVar = "CMAKE_";
   fwSearchFlagVar += linkLanguage;
@@ -1501,14 +1510,6 @@ void cmLocalGenerator::OutputLinkLibraries(
     fout << " ";
   }
 
-  // Add standard libraries for this language.
-  std::string standardLibsVar = "CMAKE_";
-  standardLibsVar += cli.GetLinkLanguage();
-  standardLibsVar += "_STANDARD_LIBRARIES";
-  std::string stdLibString;
-  if (const char* stdLibs = this->Makefile->GetDefinition(standardLibsVar)) {
-    stdLibString = stdLibs;
-  }
   if (!stdLibString.empty()) {
     fout << stdLibString << " ";
   }

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cc911145ee8a4a8bb1fcea6fecf77cba37fcf261
commit cc911145ee8a4a8bb1fcea6fecf77cba37fcf261
Author:     Stephen Kelly <steve...@gmail.com>
AuthorDate: Sat Oct 8 12:21:37 2016 +0200
Commit:     Stephen Kelly <steve...@gmail.com>
CommitDate: Sat Oct 8 12:21:37 2016 +0200

    cmLocalGenerator: Separate stdlib content from library stream

diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index c740b73..ee1d613 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1505,8 +1505,12 @@ void cmLocalGenerator::OutputLinkLibraries(
   std::string standardLibsVar = "CMAKE_";
   standardLibsVar += cli.GetLinkLanguage();
   standardLibsVar += "_STANDARD_LIBRARIES";
+  std::string stdLibString;
   if (const char* stdLibs = this->Makefile->GetDefinition(standardLibsVar)) {
-    fout << stdLibs << " ";
+    stdLibString = stdLibs;
+  }
+  if (!stdLibString.empty()) {
+    fout << stdLibString << " ";
   }
 
   linkLibraries = fout.str();

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2bfda685be5c8138d5b5d5c2366dc41665ef7064
commit 2bfda685be5c8138d5b5d5c2366dc41665ef7064
Author:     Stephen Kelly <steve...@gmail.com>
AuthorDate: Sat Oct 8 12:21:36 2016 +0200
Commit:     Stephen Kelly <steve...@gmail.com>
CommitDate: Sat Oct 8 12:21:36 2016 +0200

    cmLocalGenerator: Separate rpath content from library stream

diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 8431abb..c740b73 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1462,32 +1462,34 @@ void cmLocalGenerator::OutputLinkLibraries(
     linkLibs += " ";
   }
 
+  std::string rpath;
+
   // Check what kind of rpath flags to use.
   if (cli.GetRuntimeSep().empty()) {
     // Each rpath entry gets its own option ("-R a -R b -R c")
     std::vector<std::string> runtimeDirs;
     cli.GetRPath(runtimeDirs, relink);
 
-    std::string rpath;
     for (std::vector<std::string>::iterator ri = runtimeDirs.begin();
          ri != runtimeDirs.end(); ++ri) {
       rpath += cli.GetRuntimeFlag();
       rpath += this->ConvertToOutputFormat(*ri, shellFormat);
       rpath += " ";
     }
-    fout << rpath;
   } else {
     // All rpath entries are combined ("-Wl,-rpath,a:b:c").
-    std::string rpath = cli.GetRPathString(relink);
+    std::string rpathString = cli.GetRPathString(relink);
 
     // Store the rpath option in the stream.
-    if (!rpath.empty()) {
-      fout << cli.GetRuntimeFlag();
-      fout << this->EscapeForShell(rpath, escapeAllowMakeVars);
-      fout << " ";
+    if (!rpathString.empty()) {
+      rpath += cli.GetRuntimeFlag();
+      rpath += this->EscapeForShell(rpathString, escapeAllowMakeVars);
+      rpath += " ";
     }
   }
 
+  fout << rpath;
+
   // Write the library flags to the build rule.
   fout << linkLibs;
 

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ac5daf964a49edc00dc23c621cb5fbc6b9deca4e
commit ac5daf964a49edc00dc23c621cb5fbc6b9deca4e
Author:     Stephen Kelly <steve...@gmail.com>
AuthorDate: Sat Oct 8 12:21:36 2016 +0200
Commit:     Stephen Kelly <steve...@gmail.com>
CommitDate: Sat Oct 8 12:21:36 2016 +0200

    cmLocalGenerator: Pass link library info to OutputLinkLibraries
    
    Remove the cmGeneratorTarget from the interface.
    
    This is simplification of the OutputLinkLibraries responsibilities so
    that it can be broken apart into multiple methods.

diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index c48f790..8431abb 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1155,6 +1155,7 @@ void cmLocalGenerator::GetTargetFlags(
   bool useWatcomQuote)
 {
   const std::string buildType = cmSystemTools::UpperCase(config);
+  cmComputeLinkInformation* pcli = target->GetLinkInformation(config);
   const char* libraryLinkVariable =
     "CMAKE_SHARED_LINKER_FLAGS"; // default to shared library
 
@@ -1204,9 +1205,11 @@ void cmLocalGenerator::GetTargetFlags(
           linkFlags += " ";
         }
       }
-      this->OutputLinkLibraries(linkLineComputer, linkLibs, frameworkPath,
-                                linkPath, *target, false, false,
-                                useWatcomQuote);
+      if (pcli) {
+        this->OutputLinkLibraries(pcli, linkLineComputer, linkLibs,
+                                  frameworkPath, linkPath, false, false,
+                                  useWatcomQuote);
+      }
     } break;
     case cmState::EXECUTABLE: {
       linkFlags += this->Makefile->GetSafeDefinition("CMAKE_EXE_LINKER_FLAGS");
@@ -1225,9 +1228,11 @@ void cmLocalGenerator::GetTargetFlags(
         return;
       }
       this->AddLanguageFlags(flags, linkLanguage, buildType);
-      this->OutputLinkLibraries(linkLineComputer, linkLibs, frameworkPath,
-                                linkPath, *target, false, false,
-                                useWatcomQuote);
+      if (!pcli) {
+        this->OutputLinkLibraries(pcli, linkLineComputer, linkLibs,
+                                  frameworkPath, linkPath, false, false,
+                                  useWatcomQuote);
+      }
       if (cmSystemTools::IsOn(
             this->Makefile->GetDefinition("BUILD_SHARED_LIBS"))) {
         std::string sFlagVar = std::string("CMAKE_SHARED_BUILD_") +
@@ -1392,19 +1397,16 @@ std::string cmLocalGenerator::GetTargetFortranFlags(
  * 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)
+  cmComputeLinkInformation* pcli, cmLinkLineComputer* linkLineComputer,
+  std::string& linkLibraries, std::string& frameworkPath,
+  std::string& linkPath, bool relink, bool forResponseFile,
+  bool useWatcomQuote)
 {
   OutputFormat shellFormat =
     (forResponseFile) ? RESPONSE : ((useWatcomQuote) ? WATCOMQUOTE : SHELL);
   bool escapeAllowMakeVars = !forResponseFile;
   std::ostringstream fout;
-  std::string config = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
-  cmComputeLinkInformation* pcli = tgt.GetLinkInformation(config);
-  if (!pcli) {
-    return;
-  }
+
   cmComputeLinkInformation& cli = *pcli;
 
   std::string linkLanguage = cli.GetLinkLanguage();
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index e19cba2..12b2b69 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -19,6 +19,7 @@
 #include <string>
 #include <vector>
 
+class cmComputeLinkInformation;
 class cmCustomCommandGenerator;
 class cmGeneratorTarget;
 class cmGlobalGenerator;
@@ -347,11 +348,12 @@ public:
 
 protected:
   ///! put all the libraries for a target on into the given stream
-  void OutputLinkLibraries(cmLinkLineComputer* linkLineComputer,
+  void OutputLinkLibraries(cmComputeLinkInformation* pcli,
+                           cmLinkLineComputer* linkLineComputer,
                            std::string& linkLibraries,
                            std::string& frameworkPath, std::string& linkPath,
-                           cmGeneratorTarget&, bool relink,
-                           bool forResponseFile, bool useWatcomQuote);
+                           bool relink, bool forResponseFile,
+                           bool useWatcomQuote);
 
   // Expand rule variables in CMake of the type found in language rules
   void ExpandRuleVariables(std::string& string,
diff --git a/Source/cmMakefileTargetGenerator.cxx 
b/Source/cmMakefileTargetGenerator.cxx
index 120919b..974d62a 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -1600,9 +1600,12 @@ void cmMakefileTargetGenerator::CreateLinkLibs(
 {
   std::string frameworkPath;
   std::string linkPath;
-  this->LocalGenerator->OutputLinkLibraries(
-    linkLineComputer, linkLibs, frameworkPath, linkPath,
-    *this->GeneratorTarget, relink, useResponseFile, useWatcomQuote);
+  std::string config = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
+  cmComputeLinkInformation* pcli =
+    this->GeneratorTarget->GetLinkInformation(config);
+  this->LocalGenerator->OutputLinkLibraries(pcli, linkLineComputer, linkLibs,
+                                            frameworkPath, linkPath, relink,
+                                            useResponseFile, useWatcomQuote);
   linkLibs = frameworkPath + linkPath + linkLibs;
 
   if (useResponseFile && linkLibs.find_first_not_of(' ') != linkLibs.npos) {

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=61d7cc52ebd5bcaf9676a285268e1dc8c1131908
commit 61d7cc52ebd5bcaf9676a285268e1dc8c1131908
Author:     Stephen Kelly <steve...@gmail.com>
AuthorDate: Sat Oct 8 12:21:36 2016 +0200
Commit:     Stephen Kelly <steve...@gmail.com>
CommitDate: Sat Oct 8 12:21:36 2016 +0200

    Makefiles: Port CreateLinkLibs to cmLinkLineComputer

diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx 
b/Source/cmMakefileExecutableTargetGenerator.cxx
index 3dc7007..09967ff 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -303,10 +303,14 @@ void 
cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
     // Set path conversion for link script shells.
     this->LocalGenerator->SetLinkScriptShell(useLinkScript);
 
+    CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
+      this->CreateLinkLineComputer(
+        this->LocalGenerator->GetStateSnapshot().GetDirectory()));
+
     // Collect up flags to link in needed libraries.
     std::string linkLibs;
-    this->CreateLinkLibs(linkLibs, relink, useResponseFileForLibs, depends,
-                         useWatcomQuote);
+    this->CreateLinkLibs(linkLineComputer.get(), linkLibs, relink,
+                         useResponseFileForLibs, depends, useWatcomQuote);
 
     // Construct object file lists that may be needed to expand the
     // rule.
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx 
b/Source/cmMakefileLibraryTargetGenerator.cxx
index b12e779..e32f3a7 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -502,8 +502,13 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
     // Collect up flags to link in needed libraries.
     std::string linkLibs;
     if (this->GeneratorTarget->GetType() != cmState::STATIC_LIBRARY) {
-      this->CreateLinkLibs(linkLibs, relink, useResponseFileForLibs, depends,
-                           useWatcomQuote);
+
+      CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
+        this->CreateLinkLineComputer(
+          this->LocalGenerator->GetStateSnapshot().GetDirectory()));
+
+      this->CreateLinkLibs(linkLineComputer.get(), linkLibs, relink,
+                           useResponseFileForLibs, depends, useWatcomQuote);
     }
 
     // Construct object file lists that may be needed to expand the
diff --git a/Source/cmMakefileTargetGenerator.cxx 
b/Source/cmMakefileTargetGenerator.cxx
index 51fa79f..120919b 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -1594,18 +1594,14 @@ cmLinkLineComputer* 
cmMakefileTargetGenerator::CreateLinkLineComputer(
 }
 
 void cmMakefileTargetGenerator::CreateLinkLibs(
-  std::string& linkLibs, bool relink, bool useResponseFile,
-  std::vector<std::string>& makefile_depends, bool useWatcomQuote)
+  cmLinkLineComputer* linkLineComputer, 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,
+    linkLineComputer, linkLibs, frameworkPath, linkPath,
     *this->GeneratorTarget, relink, useResponseFile, useWatcomQuote);
   linkLibs = frameworkPath + linkPath + linkLibs;
 
diff --git a/Source/cmMakefileTargetGenerator.h 
b/Source/cmMakefileTargetGenerator.h
index 6d367bd..48fdc2f 100644
--- a/Source/cmMakefileTargetGenerator.h
+++ b/Source/cmMakefileTargetGenerator.h
@@ -20,6 +20,7 @@ class cmGeneratedFileStream;
 class cmGeneratorTarget;
 class cmGlobalUnixMakefileGenerator3;
 class cmSourceFile;
+class cmLinkLineComputer;
 
 /** \class cmMakefileTargetGenerator
  * \brief Support Routines for writing makefiles
@@ -152,7 +153,8 @@ protected:
   bool CheckUseResponseFileForLibraries(std::string const& l) const;
 
   /** Create list of flags for link libraries. */
-  void CreateLinkLibs(std::string& linkLibs, bool relink, bool useResponseFile,
+  void CreateLinkLibs(cmLinkLineComputer* linkLineComputer,
+                      std::string& linkLibs, bool relink, bool useResponseFile,
                       std::vector<std::string>& makefile_depends,
                       bool useWatcomQuote);
 

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c5800af1919ce735267f1dca4e0d9c5234ca9ce3
commit c5800af1919ce735267f1dca4e0d9c5234ca9ce3
Author:     Stephen Kelly <steve...@gmail.com>
AuthorDate: Sat Oct 8 12:21:36 2016 +0200
Commit:     Stephen Kelly <steve...@gmail.com>
CommitDate: Sat Oct 8 12:21:36 2016 +0200

    cmLinkLineComputer: Extract from cmLocalGenerator
    
    CMake has several classes which have too many responsibilities.
    cmLocalGenerator is one of them.  Start to extract the link line
    computation.  Create generator-specific implementations of the interface
    to account for generator-specific behavior.
    
    Unfortunately MSVC60 has different behavior to everything else and CMake
    still generates makefiles for it.  Isolate it with MSVC60-specific
    names.

diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index e574957..048667a 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -300,6 +300,8 @@ set(SRCS
   cmInstallDirectoryGenerator.cxx
   cmLinkedTree.h
   cmLinkItem.h
+  cmLinkLineComputer.cxx
+  cmLinkLineComputer.h
   cmListFileCache.cxx
   cmListFileCache.h
   cmListFileLexer.c
@@ -318,6 +320,8 @@ set(SRCS
   cmMakefileUtilityTargetGenerator.cxx
   cmMessenger.cxx
   cmMessenger.h
+  cmMSVC60LinkLineComputer.cxx
+  cmMSVC60LinkLineComputer.h
   cmOSXBundleGenerator.cxx
   cmOSXBundleGenerator.h
   cmOutputConverter.cxx
@@ -545,6 +549,8 @@ 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 14ea1a9..b995fa1 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -12,6 +12,7 @@
 #include "cmComputeLinkInformation.h"
 #include "cmGeneratorTarget.h"
 #include "cmGlobalCommonGenerator.h"
+#include "cmLinkLineComputer.h"
 #include "cmLocalCommonGenerator.h"
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
@@ -59,7 +60,8 @@ void cmCommonTargetGenerator::AddFeatureFlags(std::string& 
flags,
   }
 }
 
-void cmCommonTargetGenerator::AddModuleDefinitionFlag(std::string& flags)
+void cmCommonTargetGenerator::AddModuleDefinitionFlag(
+  cmLinkLineComputer* linkLineComputer, std::string& flags)
 {
   if (!this->ModuleDefinitionFile) {
     return;
@@ -76,7 +78,7 @@ void 
cmCommonTargetGenerator::AddModuleDefinitionFlag(std::string& flags)
   // vs6's "cl -link" pass it to the linker.
   std::string flag = defFileFlag;
   flag += this->LocalGenerator->ConvertToOutputFormat(
-    this->LocalGenerator->ConvertToLinkReference(
+    linkLineComputer->ConvertToLinkReference(
       this->ModuleDefinitionFile->GetFullPath()),
     cmOutputConverter::SHELL);
   this->LocalGenerator->AppendFlags(flags, flag);
diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h
index 707b81e..fe27038 100644
--- a/Source/cmCommonTargetGenerator.h
+++ b/Source/cmCommonTargetGenerator.h
@@ -16,6 +16,7 @@ class cmGlobalCommonGenerator;
 class cmLocalCommonGenerator;
 class cmMakefile;
 class cmSourceFile;
+class cmLinkLineComputer;
 
 /** \class cmCommonTargetGenerator
  * \brief Common infrastructure for Makefile and Ninja per-target generators
@@ -37,7 +38,8 @@ protected:
   bool GetFeatureAsBool(const std::string& feature);
 
   // Helper to add flag for windows .def file.
-  void AddModuleDefinitionFlag(std::string& flags);
+  void AddModuleDefinitionFlag(cmLinkLineComputer* linkLineComputer,
+                               std::string& flags);
 
   cmGeneratorTarget* GeneratorTarget;
   cmMakefile* Makefile;
diff --git a/Source/cmGhsMultiTargetGenerator.cxx 
b/Source/cmGhsMultiTargetGenerator.cxx
index 959dfdb..575ddab 100644
--- a/Source/cmGhsMultiTargetGenerator.cxx
+++ b/Source/cmGhsMultiTargetGenerator.cxx
@@ -362,9 +362,13 @@ 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(
-      config, linkLibraries, flags, linkFlags, frameworkPath, linkPath,
-      this->GeneratorTarget, useWatcomQuote);
+      linkLineComputer.get(), 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 7132ade..2266e44 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -20,7 +20,9 @@
 #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"
@@ -1412,6 +1414,18 @@ 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 74b4547..126eb6f 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -34,6 +34,7 @@ class cmExportBuildFileGenerator;
 class cmExternalMakefileProjectGenerator;
 class cmGeneratorTarget;
 class cmLocalGenerator;
+class cmLinkLineComputer;
 class cmMakefile;
 class cmake;
 
@@ -105,6 +106,12 @@ 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 adb5a95..65a1f25 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -11,6 +11,7 @@
 #include "cmLocalGenerator.h"
 #include "cmLocalNinjaGenerator.h"
 #include "cmMakefile.h"
+#include "cmNinjaLinkLineComputer.h"
 #include "cmOutputConverter.h"
 #include "cmState.h"
 #include "cmSystemTools.h"
@@ -64,6 +65,13 @@ void cmGlobalNinjaGenerator::WriteComment(std::ostream& os,
   os << "# " << comment.substr(lpos) << "\n\n";
 }
 
+cmLinkLineComputer* cmGlobalNinjaGenerator::CreateLinkLineComputer(
+  cmState::Directory /* stateDir */) const
+{
+  return new cmNinjaLinkLineComputer(
+    this->LocalGenerators[0]->GetStateSnapshot().GetDirectory(), this);
+}
+
 std::string cmGlobalNinjaGenerator::EncodeRuleName(std::string const& name)
 {
   // Ninja rule names must match "[a-zA-Z0-9_.-]+".  Use ".xx" to encode
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index 5064b21..87faf45 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -70,6 +70,9 @@ 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.
diff --git a/Source/cmLinkLineComputer.cxx b/Source/cmLinkLineComputer.cxx
new file mode 100644
index 0000000..7103a5b
--- /dev/null
+++ b/Source/cmLinkLineComputer.cxx
@@ -0,0 +1,27 @@
+/* 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
new file mode 100644
index 0000000..bd4c740
--- /dev/null
+++ b/Source/cmLinkLineComputer.h
@@ -0,0 +1,21 @@
+/* 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;
+
+private:
+  cmState::Directory StateDir;
+};
+
+#endif
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 7db879a..c48f790 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -12,6 +12,7 @@
 #include "cmInstallGenerator.h"
 #include "cmInstallScriptGenerator.h"
 #include "cmInstallTargetGenerator.h"
+#include "cmLinkLineComputer.h"
 #include "cmMakefile.h"
 #include "cmSourceFile.h"
 #include "cmSystemTools.h"
@@ -1148,9 +1149,10 @@ void 
cmLocalGenerator::GetStaticLibraryFlags(std::string& flags,
 }
 
 void cmLocalGenerator::GetTargetFlags(
-  const std::string& config, std::string& linkLibs, std::string& flags,
-  std::string& linkFlags, std::string& frameworkPath, std::string& linkPath,
-  cmGeneratorTarget* target, bool useWatcomQuote)
+  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 buildType = cmSystemTools::UpperCase(config);
   const char* libraryLinkVariable =
@@ -1202,8 +1204,9 @@ void cmLocalGenerator::GetTargetFlags(
           linkFlags += " ";
         }
       }
-      this->OutputLinkLibraries(linkLibs, frameworkPath, linkPath, *target,
-                                false, false, useWatcomQuote);
+      this->OutputLinkLibraries(linkLineComputer, linkLibs, frameworkPath,
+                                linkPath, *target, false, false,
+                                useWatcomQuote);
     } break;
     case cmState::EXECUTABLE: {
       linkFlags += this->Makefile->GetSafeDefinition("CMAKE_EXE_LINKER_FLAGS");
@@ -1222,8 +1225,9 @@ void cmLocalGenerator::GetTargetFlags(
         return;
       }
       this->AddLanguageFlags(flags, linkLanguage, buildType);
-      this->OutputLinkLibraries(linkLibs, frameworkPath, linkPath, *target,
-                                false, false, useWatcomQuote);
+      this->OutputLinkLibraries(linkLineComputer, linkLibs, frameworkPath,
+                                linkPath, *target, false, false,
+                                useWatcomQuote);
       if (cmSystemTools::IsOn(
             this->Makefile->GetDefinition("BUILD_SHARED_LIBS"))) {
         std::string sFlagVar = std::string("CMAKE_SHARED_BUILD_") +
@@ -1382,51 +1386,15 @@ std::string cmLocalGenerator::GetTargetFortranFlags(
   return std::string();
 }
 
-std::string cmLocalGenerator::ConvertToLinkReference(std::string const& lib)
-{
-#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);
-
-        return sp;
-      }
-    }
-  }
-#endif
-
-  // Normal behavior.
-  std::string relLib = lib;
-  cmState::Directory stateDir = this->GetStateSnapshot().GetDirectory();
-  if (cmOutputConverter::ContainedInDirectory(
-        stateDir.GetCurrentBinary(), lib, stateDir)) {
-    relLib = cmOutputConverter::ForceToRelativePath(
-      stateDir.GetCurrentBinary(), lib);
-  }
-  return relLib;
-}
-
 /**
  * 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(std::string& linkLibraries,
-                                           std::string& frameworkPath,
-                                           std::string& linkPath,
-                                           cmGeneratorTarget& tgt, bool relink,
-                                           bool forResponseFile,
-                                           bool useWatcomQuote)
+void cmLocalGenerator::OutputLinkLibraries(
+  cmLinkLineComputer* linkLineComputer, std::string& linkLibraries,
+  std::string& frameworkPath, std::string& linkPath, cmGeneratorTarget& tgt,
+  bool relink, bool forResponseFile, bool useWatcomQuote)
 {
   OutputFormat shellFormat =
     (forResponseFile) ? RESPONSE : ((useWatcomQuote) ? WATCOMQUOTE : SHELL);
@@ -1485,7 +1453,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& 
linkLibraries,
     }
     if (li->IsPath) {
       linkLibs += this->ConvertToOutputFormat(
-        this->ConvertToLinkReference(li->Value), shellFormat);
+        linkLineComputer->ConvertToLinkReference(li->Value), shellFormat);
     } else {
       linkLibs += li->Value;
     }
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index e16ddab..e19cba2 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -24,6 +24,7 @@ class cmGeneratorTarget;
 class cmGlobalGenerator;
 class cmMakefile;
 class cmSourceFile;
+class cmLinkLineComputer;
 
 /** \class cmLocalGenerator
  * \brief Create required build files for a directory.
@@ -312,7 +313,8 @@ public:
 
   /** Fill out these strings for the given target.  Libraries to link,
    *  flags, and linkflags. */
-  void GetTargetFlags(const std::string& config, std::string& linkLibs,
+  void 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);
@@ -345,7 +347,8 @@ public:
 
 protected:
   ///! put all the libraries for a target on into the given stream
-  void OutputLinkLibraries(std::string& linkLibraries,
+  void OutputLinkLibraries(cmLinkLineComputer* linkLineComputer,
+                           std::string& linkLibraries,
                            std::string& frameworkPath, std::string& linkPath,
                            cmGeneratorTarget&, bool relink,
                            bool forResponseFile, bool useWatcomQuote);
@@ -370,8 +373,6 @@ protected:
   std::string& CreateSafeUniqueObjectFileName(const std::string& sin,
                                               std::string const& dir_max);
 
-  virtual std::string ConvertToLinkReference(std::string const& lib);
-
   /** 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 5736581..f87aca2 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -120,12 +120,6 @@ cmGlobalNinjaGenerator* 
cmLocalNinjaGenerator::GetGlobalNinjaGenerator()
 
 // Virtual protected methods.
 
-std::string cmLocalNinjaGenerator::ConvertToLinkReference(
-  std::string const& lib)
-{
-  return this->GetGlobalNinjaGenerator()->ConvertToNinjaPath(lib);
-}
-
 std::string cmLocalNinjaGenerator::ConvertToIncludeReference(
   std::string const& path, cmOutputConverter::OutputFormat format,
   bool forceFullPaths)
diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h
index 3061b57..b04788d 100644
--- a/Source/cmLocalNinjaGenerator.h
+++ b/Source/cmLocalNinjaGenerator.h
@@ -76,8 +76,6 @@ public:
   void AppendCustomCommandDeps(cmCustomCommandGenerator const& ccg,
                                cmNinjaDeps& ninjaDeps);
 
-  std::string ConvertToLinkReference(std::string const& lib) CM_OVERRIDE;
-
   void ComputeObjectFilenames(
     std::map<cmSourceFile const*, std::string>& mapping,
     cmGeneratorTarget const* gt = CM_NULLPTR) CM_OVERRIDE;
diff --git a/Source/cmMSVC60LinkLineComputer.cxx 
b/Source/cmMSVC60LinkLineComputer.cxx
new file mode 100644
index 0000000..89432ff
--- /dev/null
+++ b/Source/cmMSVC60LinkLineComputer.cxx
@@ -0,0 +1,35 @@
+/* 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
new file mode 100644
index 0000000..c159b61
--- /dev/null
+++ b/Source/cmMSVC60LinkLineComputer.h
@@ -0,0 +1,18 @@
+/* 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 79168d8..3dc7007 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -5,6 +5,7 @@
 #include "cmGeneratedFileStream.h"
 #include "cmGeneratorTarget.h"
 #include "cmGlobalUnixMakefileGenerator3.h"
+#include "cmLinkLineComputer.h"
 #include "cmLocalGenerator.h"
 #include "cmLocalUnixMakefileGenerator3.h"
 #include "cmMakefile.h"
@@ -215,7 +216,13 @@ void 
cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
   this->LocalGenerator->AppendFlags(
     linkFlags, this->GeneratorTarget->GetProperty(linkFlagsConfig));
 
-  this->AddModuleDefinitionFlag(linkFlags);
+  {
+    CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
+      this->CreateLinkLineComputer(
+        this->LocalGenerator->GetStateSnapshot().GetDirectory()));
+
+    this->AddModuleDefinitionFlag(linkLineComputer.get(), linkFlags);
+  }
 
   // Construct a list of files associated with this executable that
   // may need to be cleaned.
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx 
b/Source/cmMakefileLibraryTargetGenerator.cxx
index 8e25f43..b12e779 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -5,6 +5,7 @@
 #include "cmGeneratedFileStream.h"
 #include "cmGeneratorTarget.h"
 #include "cmGlobalUnixMakefileGenerator3.h"
+#include "cmLinkLineComputer.h"
 #include "cmLocalGenerator.h"
 #include "cmLocalUnixMakefileGenerator3.h"
 #include "cmMakefile.h"
@@ -159,7 +160,12 @@ void 
cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink)
 
   this->LocalGenerator->AddConfigVariableFlags(
     extraFlags, "CMAKE_SHARED_LINKER_FLAGS", this->ConfigName);
-  this->AddModuleDefinitionFlag(extraFlags);
+
+  CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
+    this->CreateLinkLineComputer(
+      this->LocalGenerator->GetStateSnapshot().GetDirectory()));
+
+  this->AddModuleDefinitionFlag(linkLineComputer.get(), extraFlags);
 
   if (this->GeneratorTarget->GetProperty("LINK_WHAT_YOU_USE")) {
     this->LocalGenerator->AppendFlags(extraFlags, " -Wl,--no-as-needed");
@@ -184,7 +190,12 @@ void 
cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink)
     extraFlags, this->GeneratorTarget->GetProperty(linkFlagsConfig));
   this->LocalGenerator->AddConfigVariableFlags(
     extraFlags, "CMAKE_MODULE_LINKER_FLAGS", this->ConfigName);
-  this->AddModuleDefinitionFlag(extraFlags);
+
+  CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
+    this->CreateLinkLineComputer(
+      this->LocalGenerator->GetStateSnapshot().GetDirectory()));
+
+  this->AddModuleDefinitionFlag(linkLineComputer.get(), extraFlags);
 
   this->WriteLibraryRules(linkRuleVar, extraFlags, relink);
 }
diff --git a/Source/cmMakefileTargetGenerator.cxx 
b/Source/cmMakefileTargetGenerator.cxx
index 14102ef..51fa79f 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -10,6 +10,7 @@
 #include "cmGeneratorExpression.h"
 #include "cmGeneratorTarget.h"
 #include "cmGlobalUnixMakefileGenerator3.h"
+#include "cmLinkLineComputer.h"
 #include "cmLocalGenerator.h"
 #include "cmLocalUnixMakefileGenerator3.h"
 #include "cmMakefile.h"
@@ -1583,15 +1584,29 @@ 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;
-  this->LocalGenerator->OutputLinkLibraries(linkLibs, frameworkPath, linkPath,
-                                            *this->GeneratorTarget, relink,
-                                            useResponseFile, useWatcomQuote);
+
+  CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
+    this->CreateLinkLineComputer(
+      this->LocalGenerator->GetStateSnapshot().GetDirectory()));
+
+  this->LocalGenerator->OutputLinkLibraries(
+    linkLineComputer.get(), linkLibs, frameworkPath, linkPath,
+    *this->GeneratorTarget, relink, useResponseFile, useWatcomQuote);
   linkLibs = frameworkPath + linkPath + linkLibs;
 
   if (useResponseFile && linkLibs.find_first_not_of(' ') != linkLibs.npos) {
diff --git a/Source/cmMakefileTargetGenerator.h 
b/Source/cmMakefileTargetGenerator.h
index df7b6aa..6d367bd 100644
--- a/Source/cmMakefileTargetGenerator.h
+++ b/Source/cmMakefileTargetGenerator.h
@@ -140,6 +140,8 @@ 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/cmNinjaLinkLineComputer.cxx 
b/Source/cmNinjaLinkLineComputer.cxx
new file mode 100644
index 0000000..dd74238
--- /dev/null
+++ b/Source/cmNinjaLinkLineComputer.cxx
@@ -0,0 +1,18 @@
+/* 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, cmGlobalNinjaGenerator const* gg)
+  : cmLinkLineComputer(stateDir)
+  , GG(gg)
+{
+}
+
+std::string cmNinjaLinkLineComputer::ConvertToLinkReference(
+  std::string const& lib) const
+{
+  return GG->ConvertToNinjaPath(lib);
+}
diff --git a/Source/cmNinjaLinkLineComputer.h b/Source/cmNinjaLinkLineComputer.h
new file mode 100644
index 0000000..d86f214
--- /dev/null
+++ b/Source/cmNinjaLinkLineComputer.h
@@ -0,0 +1,25 @@
+/* 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 cmGlobalNinjaGenerator;
+
+class cmNinjaLinkLineComputer : public cmLinkLineComputer
+{
+public:
+  cmNinjaLinkLineComputer(cmState::Directory stateDir,
+                          cmGlobalNinjaGenerator const* gg);
+
+  std::string ConvertToLinkReference(std::string const& input) const
+    CM_OVERRIDE;
+
+private:
+  cmGlobalNinjaGenerator const* GG;
+};
+
+#endif
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx 
b/Source/cmNinjaNormalTargetGenerator.cxx
index 095c703..9c22353 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -8,6 +8,7 @@
 #include "cmGeneratedFileStream.h"
 #include "cmGeneratorTarget.h"
 #include "cmGlobalNinjaGenerator.h"
+#include "cmLinkLineComputer.h"
 #include "cmLocalGenerator.h"
 #include "cmLocalNinjaGenerator.h"
 #include "cmMakefile.h"
@@ -470,9 +471,14 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
   vars["TARGET_FILE"] =
     localGen.ConvertToOutputFormat(targetOutputReal, cmOutputConverter::SHELL);
 
-  localGen.GetTargetFlags(this->GetConfigName(), vars["LINK_LIBRARIES"],
-                          vars["FLAGS"], vars["LINK_FLAGS"], frameworkPath,
-                          linkPath, &genTarget, useWatcomQuote);
+  CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
+    this->GetGlobalGenerator()->CreateLinkLineComputer(
+      localGen.GetStateSnapshot().GetDirectory()));
+
+  localGen.GetTargetFlags(linkLineComputer.get(), 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())) {
@@ -497,7 +503,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
 
   this->addPoolNinjaVariable("JOB_POOL_LINK", &gt, vars);
 
-  this->AddModuleDefinitionFlag(vars["LINK_FLAGS"]);
+  this->AddModuleDefinitionFlag(linkLineComputer.get(), vars["LINK_FLAGS"]);
   vars["LINK_FLAGS"] =
     cmGlobalNinjaGenerator::EncodeLiteral(vars["LINK_FLAGS"]);
 
diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx
index a2bdf49..a58510e 100644
--- a/Source/cmServerProtocol.cxx
+++ b/Source/cmServerProtocol.cxx
@@ -7,6 +7,7 @@
 #include "cmFileMonitor.h"
 #include "cmGeneratorTarget.h"
 #include "cmGlobalGenerator.h"
+#include "cmLinkLineComputer.h"
 #include "cmListFileCache.h"
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
@@ -728,8 +729,12 @@ static Json::Value DumpTarget(cmGeneratorTarget* target,
     std::string linkLanguageFlags;
     std::string frameworkPath;
     std::string linkPath;
-    lg->GetTargetFlags(config, linkLibs, linkLanguageFlags, linkFlags,
-                       frameworkPath, linkPath, target, false);
+    CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
+      lg->GetGlobalGenerator()->CreateLinkLineComputer(
+        lg->GetStateSnapshot().GetDirectory()));
+    lg->GetTargetFlags(linkLineComputer.get(), 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 14124f8..4024ddd 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -12,6 +12,7 @@
 #include "cmGeneratorTarget.h"
 #include "cmGlobalGenerator.h"
 #include "cmGlobalGeneratorFactory.h"
+#include "cmLinkLineComputer.h"
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
 #include "cmMessenger.h"
@@ -582,8 +583,10 @@ bool cmake::FindPackage(const std::vector<std::string>& 
args)
     gg->CreateGenerationObjects();
     cmGeneratorTarget* gtgt = gg->FindGeneratorTarget(tgt->GetName());
     cmLocalGenerator* lg = gtgt->GetLocalGenerator();
-    lg->GetTargetFlags(buildType, linkLibs, flags, linkFlags, frameworkPath,
-                       linkPath, gtgt, false);
+    CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
+      gg->CreateLinkLineComputer(lg->GetStateSnapshot().GetDirectory()));
+    lg->GetTargetFlags(linkLineComputer.get(), 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 889cc33..fb8b1eb 100755
--- a/bootstrap
+++ b/bootstrap
@@ -297,6 +297,8 @@ CMAKE_CXX_SOURCES="\
   cmFileTimeComparison \
   cmGlobalUnixMakefileGenerator3 \
   cmLocalUnixMakefileGenerator3 \
+  cmLinkLineComputer \
+  cmMSVC60LinkLineComputer \
   cmMakefileExecutableTargetGenerator \
   cmMakefileLibraryTargetGenerator \
   cmMakefileTargetGenerator \

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dffcc796ef7759fcb6bdfad7c576adc88e60a7ca
commit dffcc796ef7759fcb6bdfad7c576adc88e60a7ca
Author:     Stephen Kelly <steve...@gmail.com>
AuthorDate: Sat Oct 8 12:21:35 2016 +0200
Commit:     Stephen Kelly <steve...@gmail.com>
CommitDate: Sat Oct 8 12:21:35 2016 +0200

    Ninja: Constify

diff --git a/Source/cmGlobalNinjaGenerator.cxx 
b/Source/cmGlobalNinjaGenerator.cxx
index f5a0e68..adb5a95 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -830,7 +830,8 @@ static void EnsureTrailingSlash(std::string& path)
 #endif
 }
 
-std::string cmGlobalNinjaGenerator::ConvertToNinjaPath(const std::string& path)
+std::string cmGlobalNinjaGenerator::ConvertToNinjaPath(
+  const std::string& path) const
 {
   cmLocalNinjaGenerator* ng =
     static_cast<cmLocalNinjaGenerator*>(this->LocalGenerators[0]);
@@ -1421,7 +1422,8 @@ void cmGlobalNinjaGenerator::InitOutputPathPrefix()
   EnsureTrailingSlash(this->OutputPathPrefix);
 }
 
-std::string cmGlobalNinjaGenerator::NinjaOutputPath(std::string const& path)
+std::string cmGlobalNinjaGenerator::NinjaOutputPath(
+  std::string const& path) const
 {
   if (!this->HasOutputPathPrefix() || cmSystemTools::FileIsFullPath(path)) {
     return path;
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index dcf7406..5064b21 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -233,7 +233,7 @@ public:
     return this->RulesFileStream;
   }
 
-  std::string ConvertToNinjaPath(const std::string& path);
+  std::string ConvertToNinjaPath(const std::string& path) const;
   std::string ConvertToNinjaFolderRule(const std::string& path);
 
   struct MapToNinjaPathImpl
@@ -333,7 +333,7 @@ public:
   bool SupportsConsolePool() const;
   bool SupportsImplicitOuts() const;
 
-  std::string NinjaOutputPath(std::string const& path);
+  std::string NinjaOutputPath(std::string const& path) const;
   bool HasOutputPathPrefix() const { return !this->OutputPathPrefix.empty(); }
   void StripNinjaOutputPathPrefixAsSuffix(std::string& path);
 

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c12c7f35633c1b75e4ed2c84e021065fce82716d
commit c12c7f35633c1b75e4ed2c84e021065fce82716d
Author:     Stephen Kelly <steve...@gmail.com>
AuthorDate: Sat Oct 8 12:21:35 2016 +0200
Commit:     Stephen Kelly <steve...@gmail.com>
CommitDate: Sat Oct 8 12:21:35 2016 +0200

    cmLocalGenerator: Inline conversion into link computation
    
    Make it possible to invoke this functionality independent of
    cmLocalGenerator.

diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 2284cf9..7db879a 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1406,7 +1406,14 @@ std::string 
cmLocalGenerator::ConvertToLinkReference(std::string const& lib)
 #endif
 
   // Normal behavior.
-  return this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), lib);
+  std::string relLib = lib;
+  cmState::Directory stateDir = this->GetStateSnapshot().GetDirectory();
+  if (cmOutputConverter::ContainedInDirectory(
+        stateDir.GetCurrentBinary(), lib, stateDir)) {
+    relLib = cmOutputConverter::ForceToRelativePath(
+      stateDir.GetCurrentBinary(), lib);
+  }
+  return relLib;
 }
 
 /**

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

Summary of changes:
 Source/CMakeLists.txt                          |    6 +
 Source/CMakeVersion.cmake                      |    2 +-
 Source/cmCommonTargetGenerator.cxx             |    6 +-
 Source/cmCommonTargetGenerator.h               |    4 +-
 Source/cmGhsMultiTargetGenerator.cxx           |   10 +-
 Source/cmGlobalGenerator.cxx                   |   14 ++
 Source/cmGlobalGenerator.h                     |    8 ++
 Source/cmGlobalNinjaGenerator.cxx              |   15 +-
 Source/cmGlobalNinjaGenerator.h                |    8 +-
 Source/cmLinkLineComputer.cxx                  |  179 ++++++++++++++++++++++++
 Source/cmLinkLineComputer.h                    |   50 +++++++
 Source/cmLocalGenerator.cxx                    |  167 +++++-----------------
 Source/cmLocalGenerator.h                      |   17 +--
 Source/cmLocalNinjaGenerator.cxx               |    6 -
 Source/cmLocalNinjaGenerator.h                 |    2 -
 Source/cmMSVC60LinkLineComputer.cxx            |   36 +++++
 Source/cmMSVC60LinkLineComputer.h              |   19 +++
 Source/cmMakefileExecutableTargetGenerator.cxx |   22 ++-
 Source/cmMakefileLibraryTargetGenerator.cxx    |   30 +++-
 Source/cmMakefileTargetGenerator.cxx           |   24 +++-
 Source/cmMakefileTargetGenerator.h             |   10 +-
 Source/cmNinjaLinkLineComputer.cxx             |   19 +++
 Source/cmNinjaLinkLineComputer.h               |   26 ++++
 Source/cmNinjaNormalTargetGenerator.cxx        |   15 +-
 Source/cmServerProtocol.cxx                    |    7 +-
 Source/cmake.cxx                               |    7 +-
 bootstrap                                      |    2 +
 27 files changed, 527 insertions(+), 184 deletions(-)
 create mode 100644 Source/cmLinkLineComputer.cxx
 create mode 100644 Source/cmLinkLineComputer.h
 create mode 100644 Source/cmMSVC60LinkLineComputer.cxx
 create mode 100644 Source/cmMSVC60LinkLineComputer.h
 create mode 100644 Source/cmNinjaLinkLineComputer.cxx
 create mode 100644 Source/cmNinjaLinkLineComputer.h


hooks/post-receive
-- 
CMake
_______________________________________________
Cmake-commits mailing list
Cmake-commits@cmake.org
http://public.kitware.com/mailman/listinfo/cmake-commits

Reply via email to