summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2016-10-08 10:21:39 (GMT)
committerStephen Kelly <steveire@gmail.com>2016-10-10 18:38:59 (GMT)
commit4134030434ea88024ef46f9f00b19513fc3cec4c (patch)
tree2eab60a4a8704dff0b8cdec8dfc8ccd4fd3288b8 /Source
parentf03d446e967af91460ff31eb52d840983b3d8cec (diff)
downloadCMake-4134030434ea88024ef46f9f00b19513fc3cec4c.zip
CMake-4134030434ea88024ef46f9f00b19513fc3cec4c.tar.gz
CMake-4134030434ea88024ef46f9f00b19513fc3cec4c.tar.bz2
cmLinkLineComputer: Extract link libraries computation from cmLocalGenerator
Hide some methods which no longer need to be public.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmLinkLineComputer.cxx25
-rw-r--r--Source/cmLinkLineComputer.h10
-rw-r--r--Source/cmLocalGenerator.cxx30
-rw-r--r--Source/cmLocalGenerator.h3
-rw-r--r--Source/cmMakefileTargetGenerator.cxx3
5 files changed, 37 insertions, 34 deletions
diff --git a/Source/cmLinkLineComputer.cxx b/Source/cmLinkLineComputer.cxx
index 41096ef..24f3578 100644
--- a/Source/cmLinkLineComputer.cxx
+++ b/Source/cmLinkLineComputer.cxx
@@ -152,3 +152,28 @@ std::string cmLinkLineComputer::ComputeFrameworkPath(
}
return frameworkPath;
}
+
+std::string cmLinkLineComputer::ComputeLinkLibraries(
+ cmComputeLinkInformation& cli, std::string const& stdLibString)
+{
+ std::ostringstream fout;
+ fout << this->ComputeRPath(cli);
+
+ // Write the library flags to the build rule.
+ fout << this->ComputeLinkLibs(cli);
+
+ // Add the linker runtime search path if any.
+ std::string rpath_link = cli.GetRPathLinkString();
+ if (!cli.GetRPathLinkFlag().empty() && !rpath_link.empty()) {
+ fout << cli.GetRPathLinkFlag();
+ fout << this->OutputConverter->EscapeForShell(rpath_link,
+ !this->ForResponse);
+ fout << " ";
+ }
+
+ if (!stdLibString.empty()) {
+ fout << stdLibString << " ";
+ }
+
+ return fout.str();
+}
diff --git a/Source/cmLinkLineComputer.h b/Source/cmLinkLineComputer.h
index f72368a..1fb9b24 100644
--- a/Source/cmLinkLineComputer.h
+++ b/Source/cmLinkLineComputer.h
@@ -22,18 +22,20 @@ public:
virtual std::string ConvertToLinkReference(std::string const& input) const;
- std::string ComputeLinkLibs(cmComputeLinkInformation& cli);
-
std::string ComputeLinkPath(cmComputeLinkInformation& cli,
std::string const& libPathFlag,
std::string const& libPathTerminator);
- std::string ComputeRPath(cmComputeLinkInformation& cli);
-
std::string ComputeFrameworkPath(cmComputeLinkInformation& cli,
std::string const& fwSearchFlag);
+ std::string ComputeLinkLibraries(cmComputeLinkInformation& cli,
+ std::string const& stdLibString);
+
private:
+ std::string ComputeLinkLibs(cmComputeLinkInformation& cli);
+ std::string ComputeRPath(cmComputeLinkInformation& cli);
+
std::string ConvertToOutputFormat(std::string const& input);
std::string ConvertToOutputForExisting(std::string const& input);
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index ef9e355..3b19694 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1207,7 +1207,7 @@ void cmLocalGenerator::GetTargetFlags(
}
if (pcli) {
this->OutputLinkLibraries(pcli, linkLineComputer, linkLibs,
- frameworkPath, linkPath, false);
+ frameworkPath, linkPath);
}
} break;
case cmState::EXECUTABLE: {
@@ -1229,7 +1229,7 @@ void cmLocalGenerator::GetTargetFlags(
this->AddLanguageFlags(flags, linkLanguage, buildType);
if (pcli) {
this->OutputLinkLibraries(pcli, linkLineComputer, linkLibs,
- frameworkPath, linkPath, false);
+ frameworkPath, linkPath);
}
if (cmSystemTools::IsOn(
this->Makefile->GetDefinition("BUILD_SHARED_LIBS"))) {
@@ -1397,7 +1397,7 @@ std::string cmLocalGenerator::GetTargetFortranFlags(
void cmLocalGenerator::OutputLinkLibraries(
cmComputeLinkInformation* pcli, cmLinkLineComputer* linkLineComputer,
std::string& linkLibraries, std::string& frameworkPath,
- std::string& linkPath, bool forResponseFile)
+ std::string& linkPath)
{
cmComputeLinkInformation& cli = *pcli;
@@ -1428,29 +1428,7 @@ void cmLocalGenerator::OutputLinkLibraries(
linkPath =
linkLineComputer->ComputeLinkPath(cli, libPathFlag, libPathTerminator);
- std::string linkLibs = linkLineComputer->ComputeLinkLibs(cli);
-
- std::string rpath = linkLineComputer->ComputeRPath(cli);
-
- std::ostringstream fout;
- fout << rpath;
-
- // Write the library flags to the build rule.
- fout << linkLibs;
-
- // Add the linker runtime search path if any.
- std::string rpath_link = cli.GetRPathLinkString();
- if (!cli.GetRPathLinkFlag().empty() && !rpath_link.empty()) {
- fout << cli.GetRPathLinkFlag();
- fout << this->EscapeForShell(rpath_link, !forResponseFile);
- fout << " ";
- }
-
- if (!stdLibString.empty()) {
- fout << stdLibString << " ";
- }
-
- linkLibraries = fout.str();
+ linkLibraries = linkLineComputer->ComputeLinkLibraries(cli, stdLibString);
}
std::string cmLocalGenerator::GetLinkLibsCMP0065(
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 4729acb..69c4101 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -351,8 +351,7 @@ protected:
void OutputLinkLibraries(cmComputeLinkInformation* pcli,
cmLinkLineComputer* linkLineComputer,
std::string& linkLibraries,
- std::string& frameworkPath, std::string& linkPath,
- bool forResponseFile);
+ std::string& frameworkPath, std::string& linkPath);
// Expand rule variables in CMake of the type found in language rules
void ExpandRuleVariables(std::string& string,
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index e93c31d..1483fbb 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -1610,8 +1610,7 @@ void cmMakefileTargetGenerator::CreateLinkLibs(
cmComputeLinkInformation* pcli =
this->GeneratorTarget->GetLinkInformation(config);
this->LocalGenerator->OutputLinkLibraries(pcli, linkLineComputer, linkLibs,
- frameworkPath, linkPath,
- useResponseFile);
+ frameworkPath, linkPath);
linkLibs = frameworkPath + linkPath + linkLibs;
if (useResponseFile && linkLibs.find_first_not_of(' ') != linkLibs.npos) {