diff options
author | Deniz Bahadir <dbahadir@benocs.com> | 2017-11-27 21:02:43 (GMT) |
---|---|---|
committer | Deniz Bahadir <dbahadir@benocs.com> | 2017-11-29 16:00:56 (GMT) |
commit | 85457b63c859f238ef324757f1042cc846cedbc7 (patch) | |
tree | f0c7270597e3b3be6461c6f227c2fe61508b12f3 /Source/cmTargetLinkLibrariesCommand.cxx | |
parent | 65f21a7eadc2144f0c85cd883cf63a6eb7681528 (diff) | |
download | CMake-85457b63c859f238ef324757f1042cc846cedbc7.zip CMake-85457b63c859f238ef324757f1042cc846cedbc7.tar.gz CMake-85457b63c859f238ef324757f1042cc846cedbc7.tar.bz2 |
target_link_libraries: Return earlier on some error.
Diffstat (limited to 'Source/cmTargetLinkLibrariesCommand.cxx')
-rw-r--r-- | Source/cmTargetLinkLibrariesCommand.cxx | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index 37bcb70..ec060cd 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -388,27 +388,27 @@ bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib, << this->Target->GetName() << "\" which is not built in this directory."; this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); - } else { + return false; + } - cmTarget* tgt = this->Makefile->GetGlobalGenerator()->FindTarget(lib); - - if (tgt && (tgt->GetType() != cmStateEnums::STATIC_LIBRARY) && - (tgt->GetType() != cmStateEnums::SHARED_LIBRARY) && - (tgt->GetType() != cmStateEnums::UNKNOWN_LIBRARY) && - (tgt->GetType() != cmStateEnums::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->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); - } + cmTarget* tgt = this->Makefile->GetGlobalGenerator()->FindTarget(lib); - this->Target->AddLinkLibrary(*this->Makefile, lib, llt); + if (tgt && (tgt->GetType() != cmStateEnums::STATIC_LIBRARY) && + (tgt->GetType() != cmStateEnums::SHARED_LIBRARY) && + (tgt->GetType() != cmStateEnums::UNKNOWN_LIBRARY) && + (tgt->GetType() != cmStateEnums::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->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); } + this->Target->AddLinkLibrary(*this->Makefile, lib, llt); + if (this->CurrentProcessingState == ProcessingLinkLibraries) { this->Target->AppendProperty( "INTERFACE_LINK_LIBRARIES", |