mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-05 13:20:47 -06:00
cmLinkLineComputer: Extract link libraries computation from cmLocalGenerator
Hide some methods which no longer need to be public.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user