Factor makefile generator link rule lookup into helper function

This provides a place in the makefile generators to adjust the link
rules for both libraries and executables.
This commit is contained in:
Brad King 2011-12-05 16:28:03 -05:00
parent a603250a13
commit 61e862986a
4 changed files with 12 additions and 3 deletions

View File

@ -270,8 +270,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
std::string linkRuleVar = "CMAKE_"; std::string linkRuleVar = "CMAKE_";
linkRuleVar += linkLanguage; linkRuleVar += linkLanguage;
linkRuleVar += "_LINK_EXECUTABLE"; linkRuleVar += "_LINK_EXECUTABLE";
std::string linkRule = std::string linkRule = this->GetLinkRule(linkRuleVar.c_str());
this->Makefile->GetRequiredDefinition(linkRuleVar.c_str());
std::vector<std::string> commands1; std::vector<std::string> commands1;
cmSystemTools::ExpandListArgument(linkRule, real_link_commands); cmSystemTools::ExpandListArgument(linkRule, real_link_commands);
if(this->Target->IsExecutableWithExports()) if(this->Target->IsExecutableWithExports())

View File

@ -772,7 +772,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
else else
{ {
// Get the set of commands. // Get the set of commands.
std::string linkRule = this->Makefile->GetRequiredDefinition(linkRuleVar); std::string linkRule = this->GetLinkRule(linkRuleVar);
cmSystemTools::ExpandListArgument(linkRule, real_link_commands); cmSystemTools::ExpandListArgument(linkRule, real_link_commands);
// Expand placeholders. // Expand placeholders.

View File

@ -1633,6 +1633,13 @@ void cmMakefileTargetGenerator
} }
} }
//----------------------------------------------------------------------------
std::string cmMakefileTargetGenerator::GetLinkRule(const char* linkRuleVar)
{
std::string linkRule = this->Makefile->GetRequiredDefinition(linkRuleVar);
return linkRule;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmMakefileTargetGenerator void cmMakefileTargetGenerator
::CloseFileStreams() ::CloseFileStreams()

View File

@ -120,6 +120,9 @@ protected:
// Append link rule dependencies (objects, etc.). // Append link rule dependencies (objects, etc.).
void AppendLinkDepends(std::vector<std::string>& depends); void AppendLinkDepends(std::vector<std::string>& depends);
// Lookup the link rule for this target.
std::string GetLinkRule(const char* linkRuleVar);
/** In order to support parallel builds for custom commands with /** In order to support parallel builds for custom commands with
multiple outputs the outputs are given a serial order, and only multiple outputs the outputs are given a serial order, and only
the first output actually has the build rule. Other outputs the first output actually has the build rule. Other outputs