Factor implicit link info addition into methods
In cmComputeLinkInformation::Compute we add implicit link information from languages other than the linker language to the end of the link line. This factors out that code into separate methods to improve readability and organization.
This commit is contained in:
parent
6e7020b452
commit
8aaf3cebeb
@ -553,17 +553,34 @@ bool cmComputeLinkInformation::Compute()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add implicit language runtime libraries and directories.
|
// Add implicit language runtime libraries and directories.
|
||||||
|
this->AddImplicitLinkInfo();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void cmComputeLinkInformation::AddImplicitLinkInfo()
|
||||||
|
{
|
||||||
|
// The link closure lists all languages whose implicit info is needed.
|
||||||
cmTarget::LinkClosure const* lc=this->Target->GetLinkClosure(this->Config);
|
cmTarget::LinkClosure const* lc=this->Target->GetLinkClosure(this->Config);
|
||||||
for(std::vector<std::string>::const_iterator li = lc->Languages.begin();
|
for(std::vector<std::string>::const_iterator li = lc->Languages.begin();
|
||||||
li != lc->Languages.end(); ++li)
|
li != lc->Languages.end(); ++li)
|
||||||
{
|
{
|
||||||
// Skip those of the linker language. They are implicit.
|
// Skip those of the linker language. They are implicit.
|
||||||
if(*li != this->LinkLanguage)
|
if(*li != this->LinkLanguage)
|
||||||
|
{
|
||||||
|
this->AddImplicitLinkInfo(*li);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void cmComputeLinkInformation::AddImplicitLinkInfo(std::string const& lang)
|
||||||
{
|
{
|
||||||
// Add libraries for this language that are not implied by the
|
// Add libraries for this language that are not implied by the
|
||||||
// linker language.
|
// linker language.
|
||||||
std::string libVar = "CMAKE_";
|
std::string libVar = "CMAKE_";
|
||||||
libVar += *li;
|
libVar += lang;
|
||||||
libVar += "_IMPLICIT_LINK_LIBRARIES";
|
libVar += "_IMPLICIT_LINK_LIBRARIES";
|
||||||
if(const char* libs = this->Makefile->GetDefinition(libVar.c_str()))
|
if(const char* libs = this->Makefile->GetDefinition(libVar.c_str()))
|
||||||
{
|
{
|
||||||
@ -582,7 +599,7 @@ bool cmComputeLinkInformation::Compute()
|
|||||||
// Add linker search paths for this language that are not
|
// Add linker search paths for this language that are not
|
||||||
// implied by the linker language.
|
// implied by the linker language.
|
||||||
std::string dirVar = "CMAKE_";
|
std::string dirVar = "CMAKE_";
|
||||||
dirVar += *li;
|
dirVar += lang;
|
||||||
dirVar += "_IMPLICIT_LINK_DIRECTORIES";
|
dirVar += "_IMPLICIT_LINK_DIRECTORIES";
|
||||||
if(const char* dirs = this->Makefile->GetDefinition(dirVar.c_str()))
|
if(const char* dirs = this->Makefile->GetDefinition(dirVar.c_str()))
|
||||||
{
|
{
|
||||||
@ -591,10 +608,6 @@ bool cmComputeLinkInformation::Compute()
|
|||||||
this->OrderLinkerSearchPath->AddLanguageDirectories(dirsVec);
|
this->OrderLinkerSearchPath->AddLanguageDirectories(dirsVec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmComputeLinkInformation::AddItem(std::string const& item, cmTarget* tgt)
|
void cmComputeLinkInformation::AddItem(std::string const& item, cmTarget* tgt)
|
||||||
|
@ -163,6 +163,8 @@ private:
|
|||||||
|
|
||||||
// Implicit link libraries and directories for linker language.
|
// Implicit link libraries and directories for linker language.
|
||||||
void LoadImplicitLinkInfo();
|
void LoadImplicitLinkInfo();
|
||||||
|
void AddImplicitLinkInfo();
|
||||||
|
void AddImplicitLinkInfo(std::string const& lang);
|
||||||
std::set<cmStdString> ImplicitLinkDirs;
|
std::set<cmStdString> ImplicitLinkDirs;
|
||||||
std::set<cmStdString> ImplicitLinkLibs;
|
std::set<cmStdString> ImplicitLinkLibs;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user