cmLocalGenerator: Add GetTargetFlags overload with backtraces

This commit is contained in:
Justin Goshi
2019-09-03 10:25:44 -07:00
committed by Brad King
parent 4d5bbb7704
commit 8e973b8e8d
2 changed files with 36 additions and 9 deletions

View File

@@ -1197,6 +1197,18 @@ void cmLocalGenerator::GetTargetFlags(
cmLinkLineComputer* linkLineComputer, const std::string& config,
std::string& linkLibs, std::string& flags, std::string& linkFlags,
std::string& frameworkPath, std::string& linkPath, cmGeneratorTarget* target)
{
std::vector<BT<std::string>> tmpLinkFlags;
this->GetTargetFlags(linkLineComputer, config, linkLibs, flags, tmpLinkFlags,
frameworkPath, linkPath, target);
this->AppendFlags(linkFlags, tmpLinkFlags);
}
void cmLocalGenerator::GetTargetFlags(
cmLinkLineComputer* linkLineComputer, const std::string& config,
std::string& linkLibs, std::string& flags,
std::vector<BT<std::string>>& linkFlags, std::string& frameworkPath,
std::string& linkPath, cmGeneratorTarget* target)
{
const std::string buildType = cmSystemTools::UpperCase(config);
cmComputeLinkInformation* pcli = target->GetLinkInformation(config);
@@ -1208,7 +1220,7 @@ void cmLocalGenerator::GetTargetFlags(
switch (target->GetType()) {
case cmStateEnums::STATIC_LIBRARY:
this->GetStaticLibraryFlags(linkFlags, buildType, linkLanguage, target);
linkFlags = this->GetStaticLibraryFlags(buildType, linkLanguage, target);
if (pcli && dynamic_cast<cmLinkLineDeviceComputer*>(linkLineComputer)) {
// Compute the required cuda device link libraries when
// resolving cuda device symbols
@@ -1261,10 +1273,12 @@ void cmLocalGenerator::GetTargetFlags(
}
}
linkFlags = std::move(sharedLibFlags);
if (!sharedLibFlags.empty()) {
linkFlags.emplace_back(std::move(sharedLibFlags));
}
std::vector<std::string> linkOpts;
target->GetLinkOptions(linkOpts, config, linkLanguage);
std::vector<BT<std::string>> linkOpts =
target->GetLinkOptions(config, linkLanguage);
// LINK_OPTIONS are escaped.
this->AppendCompileOptions(linkFlags, linkOpts);
if (pcli) {
@@ -1340,10 +1354,12 @@ void cmLocalGenerator::GetTargetFlags(
}
}
linkFlags = std::move(exeFlags);
if (!exeFlags.empty()) {
linkFlags.emplace_back(std::move(exeFlags));
}
std::vector<std::string> linkOpts;
target->GetLinkOptions(linkOpts, config, linkLanguage);
std::vector<BT<std::string>> linkOpts =
target->GetLinkOptions(config, linkLanguage);
// LINK_OPTIONS are escaped.
this->AppendCompileOptions(linkFlags, linkOpts);
} break;
@@ -1351,9 +1367,14 @@ void cmLocalGenerator::GetTargetFlags(
break;
}
this->AppendPositionIndependentLinkerFlags(linkFlags, target, config,
std::string extraLinkFlags;
this->AppendPositionIndependentLinkerFlags(extraLinkFlags, target, config,
linkLanguage);
this->AppendIPOLinkerFlags(linkFlags, target, config, linkLanguage);
this->AppendIPOLinkerFlags(extraLinkFlags, target, config, linkLanguage);
if (!extraLinkFlags.empty()) {
linkFlags.emplace_back(std::move(extraLinkFlags));
}
}
void cmLocalGenerator::GetTargetCompileFlags(cmGeneratorTarget* target,

View File

@@ -382,6 +382,12 @@ public:
std::string& flags, std::string& linkFlags,
std::string& frameworkPath, std::string& linkPath,
cmGeneratorTarget* target);
void GetTargetFlags(cmLinkLineComputer* linkLineComputer,
const std::string& config, std::string& linkLibs,
std::string& flags,
std::vector<BT<std::string>>& linkFlags,
std::string& frameworkPath, std::string& linkPath,
cmGeneratorTarget* target);
void GetTargetDefines(cmGeneratorTarget const* target,
std::string const& config, std::string const& lang,
std::set<std::string>& defines) const;