diff options
author | Stephen Kelly <steveire@gmail.com> | 2016-10-07 18:13:34 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2016-10-07 18:13:34 (GMT) |
commit | 4457a9f181663701961dc209740974f48213e6e7 (patch) | |
tree | 0ee6ee11ec593f59c918211348975c1a54c5cad6 | |
parent | 4d039c5b46e3cac29ff1d9ce3e768af1bca6b69a (diff) | |
download | CMake-4457a9f181663701961dc209740974f48213e6e7.zip CMake-4457a9f181663701961dc209740974f48213e6e7.tar.gz CMake-4457a9f181663701961dc209740974f48213e6e7.tar.bz2 |
cmMakefile: Return after error and remove else condition
-rw-r--r-- | Source/cmMakefile.cxx | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 7c4a2c2..f4ea8a9 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1226,25 +1226,26 @@ void cmMakefile::AddLinkLibraryForTarget(const std::string& target, 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 - if (!((tgt->GetType() == cmState::STATIC_LIBRARY) || - (tgt->GetType() == cmState::SHARED_LIBRARY) || - (tgt->GetType() == cmState::INTERFACE_LIBRARY) || - tgt->IsExecutableWithExports())) { - std::ostringstream e; - e << "Target \"" << lib << "\" of type " - << cmState::GetTargetTypeName(tgt->GetType()) - << " may not be linked into another target. " - << "One may link only to STATIC or SHARED libraries, or " - << "to executables with the ENABLE_EXPORTS property set."; - this->IssueMessage(cmake::FATAL_ERROR, e.str()); - } + return; + } + + cmTarget* tgt = this->GetGlobalGenerator()->FindTarget(lib); + if (tgt) { + // if it is not a static or shared library then you can not link to it + if (!((tgt->GetType() == cmState::STATIC_LIBRARY) || + (tgt->GetType() == cmState::SHARED_LIBRARY) || + (tgt->GetType() == cmState::INTERFACE_LIBRARY) || + tgt->IsExecutableWithExports())) { + std::ostringstream e; + e << "Target \"" << lib << "\" of type " + << cmState::GetTargetTypeName(tgt->GetType()) + << " may not be linked into another target. " + << "One may link only to STATIC or SHARED libraries, or " + << "to executables with the ENABLE_EXPORTS property set."; + this->IssueMessage(cmake::FATAL_ERROR, e.str()); } - i->second.AddLinkLibrary(*this, target, lib, llt); } + i->second.AddLinkLibrary(*this, target, lib, llt); } void cmMakefile::AddLinkDirectoryForTarget(const std::string& target, |