Add support for IMPORTED GLOBAL targets to be aliased

Issue: #15569
Issue: #17197
This commit is contained in:
Deniz Bahadir
2017-09-14 13:15:08 +02:00
committed by Brad King
parent fe4b25ec2f
commit 494906a8a2
9 changed files with 109 additions and 22 deletions

View File

@@ -140,8 +140,7 @@ bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args,
if (!aliasedTarget) {
std::ostringstream e;
e << "cannot create ALIAS target \"" << exename << "\" because target \""
<< aliasedName << "\" does not already "
"exist.";
<< aliasedName << "\" does not already exist.";
this->SetError(e.str());
return false;
}
@@ -149,15 +148,15 @@ bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args,
if (type != cmStateEnums::EXECUTABLE) {
std::ostringstream e;
e << "cannot create ALIAS target \"" << exename << "\" because target \""
<< aliasedName << "\" is not an "
"executable.";
<< aliasedName << "\" is not an executable.";
this->SetError(e.str());
return false;
}
if (aliasedTarget->IsImported()) {
if (aliasedTarget->IsImported() &&
!aliasedTarget->IsImportedGloballyVisible()) {
std::ostringstream e;
e << "cannot create ALIAS target \"" << exename << "\" because target \""
<< aliasedName << "\" is IMPORTED.";
<< aliasedName << "\" is imported but not globally visible.";
this->SetError(e.str());
return false;
}