diff options
author | Stephen Kelly <steveire@gmail.com> | 2016-10-07 18:13:36 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2016-10-07 19:25:41 (GMT) |
commit | 7edfcd0e834a4dc8d3da9cada6ad6b9b46dfb4dd (patch) | |
tree | d5b9aba310ab36fce05a62a28d70c6180713359b /Source/cmTargetLinkLibrariesCommand.cxx | |
parent | 6c8dc7f1df6d3492d11ad994a35ee2f0b8a4e60b (diff) | |
download | CMake-7edfcd0e834a4dc8d3da9cada6ad6b9b46dfb4dd.zip CMake-7edfcd0e834a4dc8d3da9cada6ad6b9b46dfb4dd.tar.gz CMake-7edfcd0e834a4dc8d3da9cada6ad6b9b46dfb4dd.tar.bz2 |
cmMakefile: Inline method into caller
The various uses of AddLinkLibraryForTarget are going away. This is the
only remaining non-deprecated use.
Diffstat (limited to 'Source/cmTargetLinkLibrariesCommand.cxx')
-rw-r--r-- | Source/cmTargetLinkLibrariesCommand.cxx | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index e714309..d1de7ef 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -338,7 +338,35 @@ bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib, // Handle normal case first. if (this->CurrentProcessingState != ProcessingKeywordLinkInterface && this->CurrentProcessingState != ProcessingPlainLinkInterface) { - this->Makefile->AddLinkLibraryForTarget(this->Target->GetName(), lib, llt); + + cmTarget* t = + this->Makefile->FindLocalNonAliasTarget(this->Target->GetName()); + if (!t) { + std::ostringstream e; + e << "Attempt to add link library \"" << lib << "\" to target \"" + << this->Target->GetName() + << "\" which is not built in this directory."; + this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + } else { + + cmTarget* tgt = this->Makefile->GetGlobalGenerator()->FindTarget(lib); + + if (tgt && (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->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + } + + this->Target->AddLinkLibrary(*this->Makefile, lib, llt); + } + if (this->CurrentProcessingState == ProcessingLinkLibraries) { this->Target->AppendProperty( "INTERFACE_LINK_LIBRARIES", |