Просмотр исходного кода

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.
Stephen Kelly 9 лет назад
Родитель
Сommit
09b6cc66b0
3 измененных файлов с 35 добавлено и 11 удалено
  1. 28 0
      Source/cmLinkLineComputer.cxx
  2. 5 0
      Source/cmLinkLineComputer.h
  3. 2 11
      Source/cmLocalGenerator.cxx

+ 28 - 0
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;
+}

+ 5 - 0
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;

+ 2 - 11
Source/cmLocalGenerator.cxx

@@ -1441,17 +1441,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);