summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-03-04 16:20:27 (GMT)
committerBrad King <brad.king@kitware.com>2014-03-04 16:20:27 (GMT)
commitc87517099abbef70b9718a3920954e9097f36bbe (patch)
treea04557e21e115e4aee39ee629ff30d554127339b /Source
parent74b982ce734dd55a4155ba8ba0462fef894d6ec0 (diff)
downloadCMake-c87517099abbef70b9718a3920954e9097f36bbe.zip
CMake-c87517099abbef70b9718a3920954e9097f36bbe.tar.gz
CMake-c87517099abbef70b9718a3920954e9097f36bbe.tar.bz2
Makefile: Factor out some duplicate link libraries generation
The generators for executable and library targets duplicate the logic to call the OutputLinkLibraries helper on the local generator. Factor it out into a cmMakefileTargetGenerator::CreateLinkLibs method to avoid dpulication.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx8
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx7
-rw-r--r--Source/cmMakefileTargetGenerator.cxx14
-rw-r--r--Source/cmMakefileTargetGenerator.h4
4 files changed, 21 insertions, 12 deletions
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index 03fdda2..696ce94 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -325,12 +325,8 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
// Collect up flags to link in needed libraries.
std::string linkLibs;
- std::string frameworkPath;
- std::string linkPath;
- this->LocalGenerator->OutputLinkLibraries(linkLibs, frameworkPath, linkPath,
- *this->GeneratorTarget,
- relink);
- linkLibs = frameworkPath + linkPath + linkLibs;
+ this->CreateLinkLibs(linkLibs, relink, depends);
+
// Construct object file lists that may be needed to expand the
// rule.
std::string buildObjs;
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 807aca8..2832515 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -546,12 +546,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
std::string linkLibs;
if(this->Target->GetType() != cmTarget::STATIC_LIBRARY)
{
- std::string frameworkPath;
- std::string linkPath;
- this->LocalGenerator
- ->OutputLinkLibraries(linkLibs, frameworkPath, linkPath,
- *this->GeneratorTarget, relink);
- linkLibs = frameworkPath + linkPath + linkLibs;
+ this->CreateLinkLibs(linkLibs, relink, depends);
}
// Construct object file lists that may be needed to expand the
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index e8a9fd1..e5b163b 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -1833,6 +1833,20 @@ cmMakefileTargetGenerator
//----------------------------------------------------------------------------
void
cmMakefileTargetGenerator
+::CreateLinkLibs(std::string& linkLibs, bool relink,
+ std::vector<std::string>& makefile_depends)
+{
+ std::string frameworkPath;
+ std::string linkPath;
+ this->LocalGenerator
+ ->OutputLinkLibraries(linkLibs, frameworkPath, linkPath,
+ *this->GeneratorTarget, relink);
+ linkLibs = frameworkPath + linkPath + linkLibs;
+}
+
+//----------------------------------------------------------------------------
+void
+cmMakefileTargetGenerator
::CreateObjectLists(bool useLinkScript, bool useArchiveRules,
bool useResponseFile, std::string& buildObjs,
std::vector<std::string>& makefile_depends)
diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h
index 4f8fafa..d47708d 100644
--- a/Source/cmMakefileTargetGenerator.h
+++ b/Source/cmMakefileTargetGenerator.h
@@ -163,6 +163,10 @@ protected:
std::string const& options,
std::vector<std::string>& makefile_depends);
+ /** Create list of flags for link libraries. */
+ void CreateLinkLibs(std::string& linkLibs, bool relink,
+ std::vector<std::string>& makefile_depends);
+
/** Create lists of object files for linking and cleaning. */
void CreateObjectLists(bool useLinkScript, bool useArchiveRules,
bool useResponseFile, std::string& buildObjs,