summaryrefslogtreecommitdiffstats
path: root/Source/cmComputeLinkInformation.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-08-24 17:15:47 (GMT)
committerBrad King <brad.king@kitware.com>2009-08-24 17:15:47 (GMT)
commit8aaf3cebeb0388eb7dde7b49ce4e7150b65908d7 (patch)
tree8b9a33e65552d65b40110f5b417ff3de62c2ae7a /Source/cmComputeLinkInformation.cxx
parent6e7020b452160865e9d546bb9ce581a49f3532ce (diff)
downloadCMake-8aaf3cebeb0388eb7dde7b49ce4e7150b65908d7.zip
CMake-8aaf3cebeb0388eb7dde7b49ce4e7150b65908d7.tar.gz
CMake-8aaf3cebeb0388eb7dde7b49ce4e7150b65908d7.tar.bz2
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.
Diffstat (limited to 'Source/cmComputeLinkInformation.cxx')
-rw-r--r--Source/cmComputeLinkInformation.cxx69
1 files changed, 41 insertions, 28 deletions
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 3405546..d4ef7e5 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -553,6 +553,15 @@ bool cmComputeLinkInformation::Compute()
}
// 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);
for(std::vector<std::string>::const_iterator li = lc->Languages.begin();
li != lc->Languages.end(); ++li)
@@ -560,40 +569,44 @@ bool cmComputeLinkInformation::Compute()
// Skip those of the linker language. They are implicit.
if(*li != this->LinkLanguage)
{
- // Add libraries for this language that are not implied by the
- // linker language.
- std::string libVar = "CMAKE_";
- libVar += *li;
- libVar += "_IMPLICIT_LINK_LIBRARIES";
- if(const char* libs = this->Makefile->GetDefinition(libVar.c_str()))
- {
- std::vector<std::string> libsVec;
- cmSystemTools::ExpandListArgument(libs, libsVec);
- for(std::vector<std::string>::const_iterator i = libsVec.begin();
- i != libsVec.end(); ++i)
- {
- if(this->ImplicitLinkLibs.find(*i) == this->ImplicitLinkLibs.end())
- {
- this->AddItem(i->c_str(), 0);
- }
- }
- }
+ this->AddImplicitLinkInfo(*li);
+ }
+ }
+}
- // Add linker search paths for this language that are not
- // implied by the linker language.
- std::string dirVar = "CMAKE_";
- dirVar += *li;
- dirVar += "_IMPLICIT_LINK_DIRECTORIES";
- if(const char* dirs = this->Makefile->GetDefinition(dirVar.c_str()))
+//----------------------------------------------------------------------------
+void cmComputeLinkInformation::AddImplicitLinkInfo(std::string const& lang)
+{
+ // Add libraries for this language that are not implied by the
+ // linker language.
+ std::string libVar = "CMAKE_";
+ libVar += lang;
+ libVar += "_IMPLICIT_LINK_LIBRARIES";
+ if(const char* libs = this->Makefile->GetDefinition(libVar.c_str()))
+ {
+ std::vector<std::string> libsVec;
+ cmSystemTools::ExpandListArgument(libs, libsVec);
+ for(std::vector<std::string>::const_iterator i = libsVec.begin();
+ i != libsVec.end(); ++i)
+ {
+ if(this->ImplicitLinkLibs.find(*i) == this->ImplicitLinkLibs.end())
{
- std::vector<std::string> dirsVec;
- cmSystemTools::ExpandListArgument(dirs, dirsVec);
- this->OrderLinkerSearchPath->AddLanguageDirectories(dirsVec);
+ this->AddItem(i->c_str(), 0);
}
}
}
- return true;
+ // Add linker search paths for this language that are not
+ // implied by the linker language.
+ std::string dirVar = "CMAKE_";
+ dirVar += lang;
+ dirVar += "_IMPLICIT_LINK_DIRECTORIES";
+ if(const char* dirs = this->Makefile->GetDefinition(dirVar.c_str()))
+ {
+ std::vector<std::string> dirsVec;
+ cmSystemTools::ExpandListArgument(dirs, dirsVec);
+ this->OrderLinkerSearchPath->AddLanguageDirectories(dirsVec);
+ }
}
//----------------------------------------------------------------------------