mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-07 22:59:56 -05:00
Add support for IMPORTED GLOBAL targets to be aliased
Issue: #15569 Issue: #17197
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -256,13 +256,6 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
|
||||
this->SetError(e.str());
|
||||
return false;
|
||||
}
|
||||
if (aliasedTarget->IsImported()) {
|
||||
std::ostringstream e;
|
||||
e << "cannot create ALIAS target \"" << libName << "\" because target \""
|
||||
<< aliasedName << "\" is IMPORTED.";
|
||||
this->SetError(e.str());
|
||||
return false;
|
||||
}
|
||||
this->Makefile->AddAlias(libName, aliasedName);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user