Commit 4d039c5b authored by Stephen Kelly's avatar Stephen Kelly
Browse files

cmMakefile: Invert handling of error condition

parent c8ec8d6a
......@@ -1221,7 +1221,12 @@ void cmMakefile::AddLinkLibraryForTarget(const std::string& target,
cmTargetLinkLibraryType llt)
{
cmTargets::iterator i = this->Targets.find(target);
if (i != this->Targets.end()) {
if (i == this->Targets.end()) {
std::ostringstream e;
e << "Attempt to add link library \"" << lib << "\" to target \"" << target
<< "\" which is not built in this directory.";
this->IssueMessage(cmake::FATAL_ERROR, e.str());
} else {
cmTarget* tgt = this->GetGlobalGenerator()->FindTarget(lib);
if (tgt) {
// if it is not a static or shared library then you can not link to it
......@@ -1239,11 +1244,6 @@ void cmMakefile::AddLinkLibraryForTarget(const std::string& target,
}
}
i->second.AddLinkLibrary(*this, target, lib, llt);
} else {
std::ostringstream e;
e << "Attempt to add link library \"" << lib << "\" to target \"" << target
<< "\" which is not built in this directory.";
this->IssueMessage(cmake::FATAL_ERROR, e.str());
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment