summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefile.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2016-10-07 18:13:34 (GMT)
committerStephen Kelly <steveire@gmail.com>2016-10-07 18:13:34 (GMT)
commit4d039c5b46e3cac29ff1d9ce3e768af1bca6b69a (patch)
treecd40fcd25743d03facad9a12ddbc52ef5a1bcc45 /Source/cmMakefile.cxx
parentc8ec8d6a7ec6c176bc14e7026dc755a9be8689cb (diff)
downloadCMake-4d039c5b46e3cac29ff1d9ce3e768af1bca6b69a.zip
CMake-4d039c5b46e3cac29ff1d9ce3e768af1bca6b69a.tar.gz
CMake-4d039c5b46e3cac29ff1d9ce3e768af1bca6b69a.tar.bz2
cmMakefile: Invert handling of error condition
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r--Source/cmMakefile.cxx12
1 files changed, 6 insertions, 6 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 3e9837d..7c4a2c2 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -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());
}
}