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.
This commit is contained in:
parent
74b982ce73
commit
c87517099a
|
@ -325,12 +325,8 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
|
||||||
|
|
||||||
// Collect up flags to link in needed libraries.
|
// Collect up flags to link in needed libraries.
|
||||||
std::string linkLibs;
|
std::string linkLibs;
|
||||||
std::string frameworkPath;
|
this->CreateLinkLibs(linkLibs, relink, depends);
|
||||||
std::string linkPath;
|
|
||||||
this->LocalGenerator->OutputLinkLibraries(linkLibs, frameworkPath, linkPath,
|
|
||||||
*this->GeneratorTarget,
|
|
||||||
relink);
|
|
||||||
linkLibs = frameworkPath + linkPath + linkLibs;
|
|
||||||
// Construct object file lists that may be needed to expand the
|
// Construct object file lists that may be needed to expand the
|
||||||
// rule.
|
// rule.
|
||||||
std::string buildObjs;
|
std::string buildObjs;
|
||||||
|
|
|
@ -546,12 +546,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
|
||||||
std::string linkLibs;
|
std::string linkLibs;
|
||||||
if(this->Target->GetType() != cmTarget::STATIC_LIBRARY)
|
if(this->Target->GetType() != cmTarget::STATIC_LIBRARY)
|
||||||
{
|
{
|
||||||
std::string frameworkPath;
|
this->CreateLinkLibs(linkLibs, relink, depends);
|
||||||
std::string linkPath;
|
|
||||||
this->LocalGenerator
|
|
||||||
->OutputLinkLibraries(linkLibs, frameworkPath, linkPath,
|
|
||||||
*this->GeneratorTarget, relink);
|
|
||||||
linkLibs = frameworkPath + linkPath + linkLibs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Construct object file lists that may be needed to expand the
|
// Construct object file lists that may be needed to expand the
|
||||||
|
|
|
@ -1830,6 +1830,20 @@ cmMakefileTargetGenerator
|
||||||
return responseFileName;
|
return responseFileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
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
|
void
|
||||||
cmMakefileTargetGenerator
|
cmMakefileTargetGenerator
|
||||||
|
|
|
@ -163,6 +163,10 @@ protected:
|
||||||
std::string const& options,
|
std::string const& options,
|
||||||
std::vector<std::string>& makefile_depends);
|
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. */
|
/** Create lists of object files for linking and cleaning. */
|
||||||
void CreateObjectLists(bool useLinkScript, bool useArchiveRules,
|
void CreateObjectLists(bool useLinkScript, bool useArchiveRules,
|
||||||
bool useResponseFile, std::string& buildObjs,
|
bool useResponseFile, std::string& buildObjs,
|
||||||
|
|
Loading…
Reference in New Issue