Merge topic 'genex-head-sensitive-conditions'

7b743a2e cmTarget: Avoid re-computing head-independent link interfaces
807e4ffe Genex: Track whether an expression depends on the 'head' target
46099b82 cmTarget: Move ComputeLinkImplementation* to internals
438d9c7c cmTarget: Re-order link interface map lookup logic
fe665fdd cmTarget: Refactor link interface map storage
9d13e167 cmTarget: Remove duplicate link interface map
This commit is contained in:
Brad King 2014-07-28 10:35:42 -04:00 committed by CMake Topic Stage
commit 9303da53ce
6 changed files with 148 additions and 76 deletions

View File

@ -97,6 +97,7 @@ const char *cmCompiledGeneratorExpression::Evaluate(
context.Quiet = quiet; context.Quiet = quiet;
context.HadError = false; context.HadError = false;
context.HadContextSensitiveCondition = false; context.HadContextSensitiveCondition = false;
context.HadHeadSensitiveCondition = false;
context.HeadTarget = headTarget; context.HeadTarget = headTarget;
context.EvaluateForBuildsystem = this->EvaluateForBuildsystem; context.EvaluateForBuildsystem = this->EvaluateForBuildsystem;
context.CurrentTarget = currentTarget ? currentTarget : headTarget; context.CurrentTarget = currentTarget ? currentTarget : headTarget;
@ -124,6 +125,7 @@ const char *cmCompiledGeneratorExpression::Evaluate(
if (!context.HadError) if (!context.HadError)
{ {
this->HadContextSensitiveCondition = context.HadContextSensitiveCondition; this->HadContextSensitiveCondition = context.HadContextSensitiveCondition;
this->HadHeadSensitiveCondition = context.HadHeadSensitiveCondition;
} }
this->DependTargets = context.DependTargets; this->DependTargets = context.DependTargets;
@ -137,6 +139,7 @@ cmCompiledGeneratorExpression::cmCompiledGeneratorExpression(
const std::string& input) const std::string& input)
: Backtrace(backtrace), Input(input), : Backtrace(backtrace), Input(input),
HadContextSensitiveCondition(false), HadContextSensitiveCondition(false),
HadHeadSensitiveCondition(false),
EvaluateForBuildsystem(false) EvaluateForBuildsystem(false)
{ {
cmGeneratorExpressionLexer l; cmGeneratorExpressionLexer l;

View File

@ -111,6 +111,10 @@ public:
{ {
return this->HadContextSensitiveCondition; return this->HadContextSensitiveCondition;
} }
bool GetHadHeadSensitiveCondition() const
{
return this->HadHeadSensitiveCondition;
}
void SetEvaluateForBuildsystem(bool eval) void SetEvaluateForBuildsystem(bool eval)
{ {
@ -141,6 +145,7 @@ private:
MaxLanguageStandard; MaxLanguageStandard;
mutable std::string Output; mutable std::string Output;
mutable bool HadContextSensitiveCondition; mutable bool HadContextSensitiveCondition;
mutable bool HadHeadSensitiveCondition;
bool EvaluateForBuildsystem; bool EvaluateForBuildsystem;
}; };

View File

@ -840,6 +840,10 @@ getLinkedTargetsContent(
{ {
context->HadContextSensitiveCondition = true; context->HadContextSensitiveCondition = true;
} }
if (cge->GetHadHeadSensitiveCondition())
{
context->HadHeadSensitiveCondition = true;
}
} }
linkedTargetsContent = linkedTargetsContent =
cmGeneratorExpression::StripEmptyListElements(linkedTargetsContent); cmGeneratorExpression::StripEmptyListElements(linkedTargetsContent);
@ -871,6 +875,10 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
cmTarget const* target = context->HeadTarget; cmTarget const* target = context->HeadTarget;
std::string propertyName = *parameters.begin(); std::string propertyName = *parameters.begin();
if (parameters.size() == 1)
{
context->HadHeadSensitiveCondition = true;
}
if (!target && parameters.size() == 1) if (!target && parameters.size() == 1)
{ {
reportError(context, content->GetOriginalExpression(), reportError(context, content->GetOriginalExpression(),
@ -1190,6 +1198,10 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
{ {
context->HadContextSensitiveCondition = true; context->HadContextSensitiveCondition = true;
} }
if (cge->GetHadHeadSensitiveCondition())
{
context->HadHeadSensitiveCondition = true;
}
if (!linkedTargetsContent.empty()) if (!linkedTargetsContent.empty())
{ {
result += (result.empty() ? "" : ";") + linkedTargetsContent; result += (result.empty() ? "" : ";") + linkedTargetsContent;
@ -1313,6 +1325,7 @@ static const struct CompileFeaturesNode : public cmGeneratorExpressionNode
"not be used with add_custom_command or add_custom_target."); "not be used with add_custom_command or add_custom_target.");
return std::string(); return std::string();
} }
context->HadHeadSensitiveCondition = true;
typedef std::map<std::string, std::vector<std::string> > LangMap; typedef std::map<std::string, std::vector<std::string> > LangMap;
static LangMap availableFeatures; static LangMap availableFeatures;
@ -1446,6 +1459,7 @@ static const struct TargetPolicyNode : public cmGeneratorExpressionNode
} }
context->HadContextSensitiveCondition = true; context->HadContextSensitiveCondition = true;
context->HadHeadSensitiveCondition = true;
for (size_t i = 1; i < cmArraySize(targetPolicyWhitelist); ++i) for (size_t i = 1; i < cmArraySize(targetPolicyWhitelist); ++i)
{ {

View File

@ -41,6 +41,7 @@ struct cmGeneratorExpressionContext
bool Quiet; bool Quiet;
bool HadError; bool HadError;
bool HadContextSensitiveCondition; bool HadContextSensitiveCondition;
bool HadHeadSensitiveCondition;
bool EvaluateForBuildsystem; bool EvaluateForBuildsystem;
}; };

View File

@ -88,11 +88,6 @@ struct cmTarget::CompileInfo
std::string CompilePdbDir; std::string CompilePdbDir;
}; };
struct TargetConfigPair : public std::pair<cmTarget const* , std::string> {
TargetConfigPair(cmTarget const* tgt, const std::string &config)
: std::pair<cmTarget const* , std::string>(tgt, config) {}
};
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
class cmTargetInternals class cmTargetInternals
{ {
@ -119,10 +114,12 @@ public:
{ {
OptionalLinkInterface(): OptionalLinkInterface():
LibrariesDone(false), AllDone(false), LibrariesDone(false), AllDone(false),
Exists(false), ExplicitLibraries(0) {} Exists(false), HadHeadSensitiveCondition(false),
ExplicitLibraries(0) {}
bool LibrariesDone; bool LibrariesDone;
bool AllDone; bool AllDone;
bool Exists; bool Exists;
bool HadHeadSensitiveCondition;
const char* ExplicitLibraries; const char* ExplicitLibraries;
}; };
void ComputeLinkInterface(cmTarget const* thisTarget, void ComputeLinkInterface(cmTarget const* thisTarget,
@ -135,17 +132,14 @@ public:
cmTarget const* head, cmTarget const* head,
bool usage_requirements_only); bool usage_requirements_only);
typedef std::map<TargetConfigPair, OptionalLinkInterface> struct HeadToLinkInterfaceMap:
public std::map<cmTarget const*, OptionalLinkInterface> {};
typedef std::map<std::string, HeadToLinkInterfaceMap>
LinkInterfaceMapType; LinkInterfaceMapType;
LinkInterfaceMapType LinkInterfaceMap; LinkInterfaceMapType LinkInterfaceMap;
LinkInterfaceMapType LinkInterfaceUsageRequirementsOnlyMap; LinkInterfaceMapType LinkInterfaceUsageRequirementsOnlyMap;
bool PolicyWarnedCMP0022; bool PolicyWarnedCMP0022;
typedef std::map<TargetConfigPair, OptionalLinkInterface>
ImportLinkInterfaceMapType;
ImportLinkInterfaceMapType ImportLinkInterfaceMap;
ImportLinkInterfaceMapType ImportLinkInterfaceUsageRequirementsOnlyMap;
typedef std::map<std::string, cmTarget::OutputInfo> OutputInfoMapType; typedef std::map<std::string, cmTarget::OutputInfo> OutputInfoMapType;
OutputInfoMapType OutputInfoMap; OutputInfoMapType OutputInfoMap;
@ -159,12 +153,25 @@ public:
struct OptionalLinkImplementation: public cmTarget::LinkImplementation struct OptionalLinkImplementation: public cmTarget::LinkImplementation
{ {
OptionalLinkImplementation(): OptionalLinkImplementation():
LibrariesDone(false), LanguagesDone(false) {} LibrariesDone(false), LanguagesDone(false),
HadHeadSensitiveCondition(false) {}
bool LibrariesDone; bool LibrariesDone;
bool LanguagesDone; bool LanguagesDone;
bool HadHeadSensitiveCondition;
}; };
typedef std::map<TargetConfigPair, void ComputeLinkImplementationLibraries(cmTarget const* thisTarget,
OptionalLinkImplementation> LinkImplMapType; const std::string& config,
OptionalLinkImplementation& impl,
cmTarget const* head) const;
void ComputeLinkImplementationLanguages(cmTarget const* thisTarget,
const std::string& config,
OptionalLinkImplementation& impl
) const;
struct HeadToLinkImplementationMap:
public std::map<cmTarget const*, OptionalLinkImplementation> {};
typedef std::map<std::string,
HeadToLinkImplementationMap> LinkImplMapType;
LinkImplMapType LinkImplMap; LinkImplMapType LinkImplMap;
typedef std::map<std::string, cmTarget::LinkClosure> LinkClosureMapType; typedef std::map<std::string, cmTarget::LinkClosure> LinkClosureMapType;
@ -528,8 +535,6 @@ void cmTarget::ClearLinkMaps()
this->Internal->LinkImplMap.clear(); this->Internal->LinkImplMap.clear();
this->Internal->LinkInterfaceMap.clear(); this->Internal->LinkInterfaceMap.clear();
this->Internal->LinkInterfaceUsageRequirementsOnlyMap.clear(); this->Internal->LinkInterfaceUsageRequirementsOnlyMap.clear();
this->Internal->ImportLinkInterfaceMap.clear();
this->Internal->ImportLinkInterfaceUsageRequirementsOnlyMap.clear();
this->Internal->LinkClosureMap.clear(); this->Internal->LinkClosureMap.clear();
for (cmTargetLinkInformationMap::const_iterator it for (cmTargetLinkInformationMap::const_iterator it
= this->LinkInformation.begin(); = this->LinkInformation.begin();
@ -3434,7 +3439,8 @@ void cmTarget::ExpandLinkItems(std::string const& prop,
std::string const& config, std::string const& config,
cmTarget const* headTarget, cmTarget const* headTarget,
bool usage_requirements_only, bool usage_requirements_only,
std::vector<cmLinkItem>& items) const std::vector<cmLinkItem>& items,
bool& hadHeadSensitiveCondition) const
{ {
cmGeneratorExpression ge; cmGeneratorExpression ge;
cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), prop, 0, 0); cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), prop, 0, 0);
@ -3445,13 +3451,15 @@ void cmTarget::ExpandLinkItems(std::string const& prop,
dagChecker.SetTransitivePropertiesOnly(); dagChecker.SetTransitivePropertiesOnly();
} }
std::vector<std::string> libs; std::vector<std::string> libs;
cmSystemTools::ExpandListArgument(ge.Parse(value)->Evaluate( cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value);
cmSystemTools::ExpandListArgument(cge->Evaluate(
this->Makefile, this->Makefile,
config, config,
false, false,
headTarget, headTarget,
this, &dagChecker), libs); this, &dagChecker), libs);
this->LookupLinkItems(libs, items); this->LookupLinkItems(libs, items);
hadHeadSensitiveCondition = cge->GetHadHeadSensitiveCondition();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -5753,10 +5761,18 @@ cmTarget::LinkInterface const* cmTarget::GetLinkInterface(
} }
// Lookup any existing link interface for this configuration. // Lookup any existing link interface for this configuration.
TargetConfigPair key(head, cmSystemTools::UpperCase(config)); std::string CONFIG = cmSystemTools::UpperCase(config);
cmTargetInternals::HeadToLinkInterfaceMap& hm =
this->Internal->LinkInterfaceMap[CONFIG];
cmTargetInternals::OptionalLinkInterface& // If the link interface does not depend on the head target
iface = this->Internal->LinkInterfaceMap[key]; // then return the one we computed first.
if(!hm.empty() && !hm.begin()->second.HadHeadSensitiveCondition)
{
return &hm.begin()->second;
}
cmTargetInternals::OptionalLinkInterface& iface = hm[head];
if(!iface.LibrariesDone) if(!iface.LibrariesDone)
{ {
iface.LibrariesDone = true; iface.LibrariesDone = true;
@ -5796,13 +5812,20 @@ cmTarget::GetLinkInterfaceLibraries(const std::string& config,
} }
// Lookup any existing link interface for this configuration. // Lookup any existing link interface for this configuration.
TargetConfigPair key(head, cmSystemTools::UpperCase(config)); std::string CONFIG = cmSystemTools::UpperCase(config);
cmTargetInternals::LinkInterfaceMapType& lim = cmTargetInternals::HeadToLinkInterfaceMap& hm =
(usage_requirements_only ? (usage_requirements_only ?
this->Internal->LinkInterfaceUsageRequirementsOnlyMap : this->Internal->LinkInterfaceUsageRequirementsOnlyMap[CONFIG] :
this->Internal->LinkInterfaceMap); this->Internal->LinkInterfaceMap[CONFIG]);
cmTargetInternals::OptionalLinkInterface& iface = lim[key]; // If the link interface does not depend on the head target
// then return the one we computed first.
if(!hm.empty() && !hm.begin()->second.HadHeadSensitiveCondition)
{
return &hm.begin()->second;
}
cmTargetInternals::OptionalLinkInterface& iface = hm[head];
if(!iface.LibrariesDone) if(!iface.LibrariesDone)
{ {
iface.LibrariesDone = true; iface.LibrariesDone = true;
@ -5825,13 +5848,20 @@ cmTarget::GetImportLinkInterface(const std::string& config,
return 0; return 0;
} }
TargetConfigPair key(headTarget, cmSystemTools::UpperCase(config)); std::string CONFIG = cmSystemTools::UpperCase(config);
cmTargetInternals::ImportLinkInterfaceMapType& lim = cmTargetInternals::HeadToLinkInterfaceMap& hm =
(usage_requirements_only ? (usage_requirements_only ?
this->Internal->ImportLinkInterfaceUsageRequirementsOnlyMap : this->Internal->LinkInterfaceUsageRequirementsOnlyMap[CONFIG] :
this->Internal->ImportLinkInterfaceMap); this->Internal->LinkInterfaceMap[CONFIG]);
cmTargetInternals::OptionalLinkInterface& iface = lim[key]; // If the link interface does not depend on the head target
// then return the one we computed first.
if(!hm.empty() && !hm.begin()->second.HadHeadSensitiveCondition)
{
return &hm.begin()->second;
}
cmTargetInternals::OptionalLinkInterface& iface = hm[headTarget];
if(!iface.AllDone) if(!iface.AllDone)
{ {
iface.AllDone = true; iface.AllDone = true;
@ -5839,7 +5869,8 @@ cmTarget::GetImportLinkInterface(const std::string& config,
cmSystemTools::ExpandListArgument(info->Languages, iface.Languages); cmSystemTools::ExpandListArgument(info->Languages, iface.Languages);
this->ExpandLinkItems(info->LibrariesProp, info->Libraries, config, this->ExpandLinkItems(info->LibrariesProp, info->Libraries, config,
headTarget, usage_requirements_only, headTarget, usage_requirements_only,
iface.Libraries); iface.Libraries,
iface.HadHeadSensitiveCondition);
std::vector<std::string> deps; std::vector<std::string> deps;
cmSystemTools::ExpandListArgument(info->SharedDeps, deps); cmSystemTools::ExpandListArgument(info->SharedDeps, deps);
this->LookupLinkItems(deps, iface.SharedDeps); this->LookupLinkItems(deps, iface.SharedDeps);
@ -6023,7 +6054,8 @@ cmTargetInternals::ComputeLinkInterfaceLibraries(
// The interface libraries have been explicitly set. // The interface libraries have been explicitly set.
thisTarget->ExpandLinkItems(linkIfaceProp, explicitLibraries, config, thisTarget->ExpandLinkItems(linkIfaceProp, explicitLibraries, config,
headTarget, usage_requirements_only, headTarget, usage_requirements_only,
iface.Libraries); iface.Libraries,
iface.HadHeadSensitiveCondition);
} }
else if (thisTarget->PolicyStatusCMP0022 == cmPolicies::WARN else if (thisTarget->PolicyStatusCMP0022 == cmPolicies::WARN
|| thisTarget->PolicyStatusCMP0022 == cmPolicies::OLD) || thisTarget->PolicyStatusCMP0022 == cmPolicies::OLD)
@ -6046,9 +6078,10 @@ cmTargetInternals::ComputeLinkInterfaceLibraries(
static const std::string newProp = "INTERFACE_LINK_LIBRARIES"; static const std::string newProp = "INTERFACE_LINK_LIBRARIES";
if(const char* newExplicitLibraries = thisTarget->GetProperty(newProp)) if(const char* newExplicitLibraries = thisTarget->GetProperty(newProp))
{ {
bool hadHeadSensitiveConditionDummy = false;
thisTarget->ExpandLinkItems(newProp, newExplicitLibraries, config, thisTarget->ExpandLinkItems(newProp, newExplicitLibraries, config,
headTarget, usage_requirements_only, headTarget, usage_requirements_only,
ifaceLibs); ifaceLibs, hadHeadSensitiveConditionDummy);
} }
if (ifaceLibs != iface.Libraries) if (ifaceLibs != iface.Libraries)
{ {
@ -6233,18 +6266,19 @@ cmTarget::GetLinkImplementation(const std::string& config) const
} }
// Populate the link implementation for this configuration. // Populate the link implementation for this configuration.
TargetConfigPair key(this, cmSystemTools::UpperCase(config)); std::string CONFIG = cmSystemTools::UpperCase(config);
cmTargetInternals::OptionalLinkImplementation& cmTargetInternals::OptionalLinkImplementation&
impl = this->Internal->LinkImplMap[key]; impl = this->Internal->LinkImplMap[CONFIG][this];
if(!impl.LibrariesDone) if(!impl.LibrariesDone)
{ {
impl.LibrariesDone = true; impl.LibrariesDone = true;
this->ComputeLinkImplementationLibraries(config, impl, this); this->Internal
->ComputeLinkImplementationLibraries(this, config, impl, this);
} }
if(!impl.LanguagesDone) if(!impl.LanguagesDone)
{ {
impl.LanguagesDone = true; impl.LanguagesDone = true;
this->ComputeLinkImplementationLanguages(config, impl); this->Internal->ComputeLinkImplementationLanguages(this, config, impl);
} }
return &impl; return &impl;
} }
@ -6268,57 +6302,73 @@ cmTarget::GetLinkImplementationLibrariesInternal(const std::string& config,
} }
// Populate the link implementation libraries for this configuration. // Populate the link implementation libraries for this configuration.
TargetConfigPair key(head, cmSystemTools::UpperCase(config)); std::string CONFIG = cmSystemTools::UpperCase(config);
cmTargetInternals::OptionalLinkImplementation& cmTargetInternals::HeadToLinkImplementationMap& hm =
impl = this->Internal->LinkImplMap[key]; this->Internal->LinkImplMap[CONFIG];
// If the link implementation does not depend on the head target
// then return the one we computed first.
if(!hm.empty() && !hm.begin()->second.HadHeadSensitiveCondition)
{
return &hm.begin()->second;
}
cmTargetInternals::OptionalLinkImplementation& impl = hm[head];
if(!impl.LibrariesDone) if(!impl.LibrariesDone)
{ {
impl.LibrariesDone = true; impl.LibrariesDone = true;
this->ComputeLinkImplementationLibraries(config, impl, head); this->Internal
->ComputeLinkImplementationLibraries(this, config, impl, head);
} }
return &impl; return &impl;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void void
cmTarget::ComputeLinkImplementationLibraries(const std::string& config, cmTargetInternals::ComputeLinkImplementationLibraries(
LinkImplementation& impl, cmTarget const* thisTarget,
cmTarget const* head) const const std::string& config,
OptionalLinkImplementation& impl,
cmTarget const* head) const
{ {
// Collect libraries directly linked in this configuration. // Collect libraries directly linked in this configuration.
for (std::vector<cmValueWithOrigin>::const_iterator for (std::vector<cmValueWithOrigin>::const_iterator
le = this->Internal->LinkImplementationPropertyEntries.begin(), le = this->LinkImplementationPropertyEntries.begin(),
end = this->Internal->LinkImplementationPropertyEntries.end(); end = this->LinkImplementationPropertyEntries.end();
le != end; ++le) le != end; ++le)
{ {
std::vector<std::string> llibs; std::vector<std::string> llibs;
cmGeneratorExpressionDAGChecker dagChecker( cmGeneratorExpressionDAGChecker dagChecker(
this->GetName(), thisTarget->GetName(),
"LINK_LIBRARIES", 0, 0); "LINK_LIBRARIES", 0, 0);
cmGeneratorExpression ge(&le->Backtrace); cmGeneratorExpression ge(&le->Backtrace);
cmsys::auto_ptr<cmCompiledGeneratorExpression> const cge = cmsys::auto_ptr<cmCompiledGeneratorExpression> const cge =
ge.Parse(le->Value); ge.Parse(le->Value);
std::string const evaluated = std::string const evaluated =
cge->Evaluate(this->Makefile, config, false, head, &dagChecker); cge->Evaluate(thisTarget->Makefile, config, false, head, &dagChecker);
cmSystemTools::ExpandListArgument(evaluated, llibs); cmSystemTools::ExpandListArgument(evaluated, llibs);
if(cge->GetHadHeadSensitiveCondition())
{
impl.HadHeadSensitiveCondition = true;
}
for(std::vector<std::string>::const_iterator li = llibs.begin(); for(std::vector<std::string>::const_iterator li = llibs.begin();
li != llibs.end(); ++li) li != llibs.end(); ++li)
{ {
// Skip entries that resolve to the target itself or are empty. // Skip entries that resolve to the target itself or are empty.
std::string name = this->CheckCMP0004(*li); std::string name = thisTarget->CheckCMP0004(*li);
if(name == this->GetName() || name.empty()) if(name == thisTarget->GetName() || name.empty())
{ {
if(name == this->GetName()) if(name == thisTarget->GetName())
{ {
bool noMessage = false; bool noMessage = false;
cmake::MessageType messageType = cmake::FATAL_ERROR; cmake::MessageType messageType = cmake::FATAL_ERROR;
cmOStringStream e; cmOStringStream e;
switch(this->GetPolicyStatusCMP0038()) switch(thisTarget->GetPolicyStatusCMP0038())
{ {
case cmPolicies::WARN: case cmPolicies::WARN:
{ {
e << (this->Makefile->GetPolicies() e << (thisTarget->Makefile->GetPolicies()
->GetPolicyWarning(cmPolicies::CMP0038)) << "\n"; ->GetPolicyWarning(cmPolicies::CMP0038)) << "\n";
messageType = cmake::AUTHOR_WARNING; messageType = cmake::AUTHOR_WARNING;
} }
@ -6334,9 +6384,9 @@ cmTarget::ComputeLinkImplementationLibraries(const std::string& config,
if(!noMessage) if(!noMessage)
{ {
e << "Target \"" << this->GetName() << "\" links to itself."; e << "Target \"" << thisTarget->GetName() << "\" links to itself.";
this->Makefile->GetCMakeInstance()->IssueMessage( thisTarget->Makefile->GetCMakeInstance()->IssueMessage(
messageType, e.str(), this->GetBacktrace()); messageType, e.str(), thisTarget->GetBacktrace());
if (messageType == cmake::FATAL_ERROR) if (messageType == cmake::FATAL_ERROR)
{ {
return; return;
@ -6348,7 +6398,7 @@ cmTarget::ComputeLinkImplementationLibraries(const std::string& config,
// The entry is meant for this configuration. // The entry is meant for this configuration.
impl.Libraries.push_back( impl.Libraries.push_back(
cmLinkImplItem(name, this->FindTargetToLink(name), cmLinkImplItem(name, thisTarget->FindTargetToLink(name),
le->Backtrace, evaluated != le->Value)); le->Backtrace, evaluated != le->Value));
} }
@ -6356,42 +6406,45 @@ cmTarget::ComputeLinkImplementationLibraries(const std::string& config,
for (std::set<std::string>::const_iterator it = seenProps.begin(); for (std::set<std::string>::const_iterator it = seenProps.begin();
it != seenProps.end(); ++it) it != seenProps.end(); ++it)
{ {
if (!this->GetProperty(*it)) if (!thisTarget->GetProperty(*it))
{ {
this->LinkImplicitNullProperties.insert(*it); thisTarget->LinkImplicitNullProperties.insert(*it);
} }
} }
cge->GetMaxLanguageStandard(this, this->MaxLanguageStandards); cge->GetMaxLanguageStandard(thisTarget, thisTarget->MaxLanguageStandards);
} }
cmTarget::LinkLibraryType linkType = this->ComputeLinkType(config); cmTarget::LinkLibraryType linkType = thisTarget->ComputeLinkType(config);
LinkLibraryVectorType const& oldllibs = this->GetOriginalLinkLibraries(); cmTarget::LinkLibraryVectorType const& oldllibs =
thisTarget->GetOriginalLinkLibraries();
for(cmTarget::LinkLibraryVectorType::const_iterator li = oldllibs.begin(); for(cmTarget::LinkLibraryVectorType::const_iterator li = oldllibs.begin();
li != oldllibs.end(); ++li) li != oldllibs.end(); ++li)
{ {
if(li->second != cmTarget::GENERAL && li->second != linkType) if(li->second != cmTarget::GENERAL && li->second != linkType)
{ {
std::string name = this->CheckCMP0004(li->first); std::string name = thisTarget->CheckCMP0004(li->first);
if(name == this->GetName() || name.empty()) if(name == thisTarget->GetName() || name.empty())
{ {
continue; continue;
} }
// Support OLD behavior for CMP0003. // Support OLD behavior for CMP0003.
impl.WrongConfigLibraries.push_back( impl.WrongConfigLibraries.push_back(
cmLinkItem(name, this->FindTargetToLink(name))); cmLinkItem(name, thisTarget->FindTargetToLink(name)));
} }
} }
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void void
cmTarget::ComputeLinkImplementationLanguages(const std::string& config, cmTargetInternals::ComputeLinkImplementationLanguages(
LinkImplementation& impl) const cmTarget const* thisTarget,
const std::string& config,
OptionalLinkImplementation& impl) const
{ {
// This target needs runtime libraries for its source languages. // This target needs runtime libraries for its source languages.
std::set<std::string> languages; std::set<std::string> languages;
// Get languages used in our source files. // Get languages used in our source files.
this->GetLanguages(languages, config); thisTarget->GetLanguages(languages, config);
// Copy the set of langauges to the link implementation. // Copy the set of langauges to the link implementation.
for(std::set<std::string>::iterator li = languages.begin(); for(std::set<std::string>::iterator li = languages.begin();
li != languages.end(); ++li) li != languages.end(); ++li)

View File

@ -797,17 +797,13 @@ private:
LinkImplementationLibraries const* LinkImplementationLibraries const*
GetLinkImplementationLibrariesInternal(const std::string& config, GetLinkImplementationLibrariesInternal(const std::string& config,
cmTarget const* head) const; cmTarget const* head) const;
void ComputeLinkImplementationLibraries(const std::string& config,
LinkImplementation& impl,
cmTarget const* head) const;
void ComputeLinkImplementationLanguages(const std::string& config,
LinkImplementation& impl) const;
void ComputeLinkClosure(const std::string& config, LinkClosure& lc) const; void ComputeLinkClosure(const std::string& config, LinkClosure& lc) const;
void ExpandLinkItems(std::string const& prop, std::string const& value, void ExpandLinkItems(std::string const& prop, std::string const& value,
std::string const& config, cmTarget const* headTarget, std::string const& config, cmTarget const* headTarget,
bool usage_requirements_only, bool usage_requirements_only,
std::vector<cmLinkItem>& items) const; std::vector<cmLinkItem>& items,
bool& hadHeadSensitiveCondition) const;
void LookupLinkItems(std::vector<std::string> const& names, void LookupLinkItems(std::vector<std::string> const& names,
std::vector<cmLinkItem>& items) const; std::vector<cmLinkItem>& items) const;