|
|
@@ -364,7 +364,7 @@ bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib,
|
|
|
if (this->CurrentProcessingState != ProcessingKeywordLinkInterface &&
|
|
|
this->CurrentProcessingState != ProcessingPlainLinkInterface) {
|
|
|
|
|
|
- // Assure that the target on the LHS was created in the current directory.
|
|
|
+ // Find target on the LHS locally
|
|
|
cmTarget* t =
|
|
|
this->Makefile->FindLocalNonAliasTarget(this->Target->GetName());
|
|
|
if (!t) {
|
|
|
@@ -377,11 +377,18 @@ bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib,
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ // If no local target has been found, find it in the global scope
|
|
|
+ if (!t) {
|
|
|
+ t = this->Makefile->GetGlobalGenerator()->FindTarget(
|
|
|
+ this->Target->GetName(), true);
|
|
|
+ }
|
|
|
+
|
|
|
if (!t) {
|
|
|
std::ostringstream e;
|
|
|
e << "Attempt to add link library \"" << lib << "\" to target \""
|
|
|
<< this->Target->GetName()
|
|
|
- << "\" which is not built in this directory.";
|
|
|
+ << "\" which does not exist or is an alias target.";
|
|
|
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
|
|
|
return false;
|
|
|
}
|