summaryrefslogtreecommitdiffstats
path: root/Source/cmTarget.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2014-02-09 14:35:28 (GMT)
committerStephen Kelly <steveire@gmail.com>2014-02-09 14:35:28 (GMT)
commitb29152387dc8b95895beb98d8f03d2b1c9532ed9 (patch)
treef25eee0fd19d4cf889a55e90f4e1b65dff947953 /Source/cmTarget.cxx
parent1cc3e9f2e73b96370257b55f9c96586a898fe9a4 (diff)
downloadCMake-b29152387dc8b95895beb98d8f03d2b1c9532ed9.zip
CMake-b29152387dc8b95895beb98d8f03d2b1c9532ed9.tar.gz
CMake-b29152387dc8b95895beb98d8f03d2b1c9532ed9.tar.bz2
CMP0028: Trigger on libraries from INTERFACE of dependencies.
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r--Source/cmTarget.cxx95
1 files changed, 49 insertions, 46 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index e51095e..18ba7c8 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -2832,12 +2832,54 @@ public:
cmTargetCollectLinkLanguages(cmTarget const* target, const char* config,
std::set<cmStdString>& languages,
cmTarget const* head):
- Config(config), Languages(languages), HeadTarget(head)
+ Config(config), Languages(languages), HeadTarget(head),
+ Makefile(target->GetMakefile()), Target(target)
{ this->Visited.insert(target); }
- void Visit(cmTarget const* target)
+ void Visit(const std::string& name)
{
- if(!target || !this->Visited.insert(target).second)
+ cmTarget *target = this->Makefile->FindTargetToUse(name);
+
+ if(!target)
+ {
+ if(name.find("::") != std::string::npos)
+ {
+ bool noMessage = false;
+ cmake::MessageType messageType = cmake::FATAL_ERROR;
+ cmOStringStream e;
+ switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0028))
+ {
+ case cmPolicies::WARN:
+ {
+ e << (this->Makefile->GetPolicies()
+ ->GetPolicyWarning(cmPolicies::CMP0028)) << "\n";
+ messageType = cmake::AUTHOR_WARNING;
+ }
+ break;
+ case cmPolicies::OLD:
+ noMessage = true;
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::NEW:
+ // Issue the fatal message.
+ break;
+ }
+
+ if(!noMessage)
+ {
+ e << "Target \"" << this->Target->GetName()
+ << "\" links to target \"" << name
+ << "\" but the target was not found. Perhaps a find_package() "
+ "call is missing for an IMPORTED target, or an ALIAS target is "
+ "missing?";
+ this->Makefile->GetCMakeInstance()->IssueMessage(messageType,
+ e.str(),
+ this->Target->GetBacktrace());
+ }
+ }
+ return;
+ }
+ if(!this->Visited.insert(target).second)
{
return;
}
@@ -2852,17 +2894,18 @@ public:
this->Languages.insert(*li);
}
- cmMakefile* mf = target->GetMakefile();
for(std::vector<std::string>::const_iterator
li = iface->Libraries.begin(); li != iface->Libraries.end(); ++li)
{
- this->Visit(mf->FindTargetToUse(*li));
+ this->Visit(*li);
}
}
private:
const char* Config;
std::set<cmStdString>& Languages;
cmTarget const* HeadTarget;
+ cmMakefile* Makefile;
+ const cmTarget* Target;
std::set<cmTarget const*> Visited;
};
@@ -2964,7 +3007,7 @@ void cmTarget::ComputeLinkClosure(const char* config, LinkClosure& lc,
for(std::vector<std::string>::const_iterator li = impl->Libraries.begin();
li != impl->Libraries.end(); ++li)
{
- cll.Visit(this->Makefile->FindTargetToUse(*li));
+ cll.Visit(*li);
}
// Store the transitive closure of languages.
@@ -5619,46 +5662,6 @@ void cmTarget::ComputeLinkImplementation(const char* config,
}
continue;
}
- cmTarget *tgt = this->Makefile->FindTargetToUse(*li);
-
- if(!tgt && std::string(item).find("::") != std::string::npos)
- {
- bool noMessage = false;
- cmake::MessageType messageType = cmake::FATAL_ERROR;
- cmOStringStream e;
- switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0028))
- {
- case cmPolicies::WARN:
- {
- e << (this->Makefile->GetPolicies()
- ->GetPolicyWarning(cmPolicies::CMP0028)) << "\n";
- messageType = cmake::AUTHOR_WARNING;
- }
- break;
- case cmPolicies::OLD:
- noMessage = true;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::NEW:
- // Issue the fatal message.
- break;
- }
-
- if(!noMessage)
- {
- e << "Target \"" << this->GetName() << "\" links to target \"" << item
- << "\" but the target was not found. Perhaps a find_package() "
- "call is missing for an IMPORTED target, or an ALIAS target is "
- "missing?";
- this->Makefile->GetCMakeInstance()->IssueMessage(messageType,
- e.str(),
- this->GetBacktrace());
- if (messageType == cmake::FATAL_ERROR)
- {
- return;
- }
- }
- }
// The entry is meant for this configuration.
impl.Libraries.push_back(item);