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

Makefiles: Port CreateLinkLibs to cmLinkLineComputer

Stephen Kelly 9 лет назад
Родитель
Сommit
6929581206

+ 6 - 2
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.

+ 7 - 2
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

+ 4 - 8
Source/cmMakefileTargetGenerator.cxx

@@ -1599,18 +1599,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;
 

+ 3 - 1
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
@@ -151,7 +152,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);