summaryrefslogtreecommitdiffstats
path: root/Source/cmAddLibraryCommand.cxx
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2020-05-28 11:51:22 (GMT)
committerMarc Chevrier <marc.chevrier@gmail.com>2020-06-02 15:11:47 (GMT)
commit056489d567b657bd1ebeae8bf78f4937f900b2e0 (patch)
treed3800c8fdf726c1e04cf73e463b68861efe6abd3 /Source/cmAddLibraryCommand.cxx
parent254f2b9058f814e952ef0178e13b3f98e8d216a1 (diff)
downloadCMake-056489d567b657bd1ebeae8bf78f4937f900b2e0.zip
CMake-056489d567b657bd1ebeae8bf78f4937f900b2e0.tar.gz
CMake-056489d567b657bd1ebeae8bf78f4937f900b2e0.tar.bz2
add_library/add_executable: allow local alias to imported targets
Fixes: #20641
Diffstat (limited to 'Source/cmAddLibraryCommand.cxx')
-rw-r--r--Source/cmAddLibraryCommand.cxx11
1 files changed, 3 insertions, 8 deletions
diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx
index d79c04f..3e5d764 100644
--- a/Source/cmAddLibraryCommand.cxx
+++ b/Source/cmAddLibraryCommand.cxx
@@ -219,14 +219,9 @@ bool cmAddLibraryCommand(std::vector<std::string> const& args,
"\" is not a library."));
return false;
}
- if (aliasedTarget->IsImported() &&
- !aliasedTarget->IsImportedGloballyVisible()) {
- status.SetError(cmStrCat("cannot create ALIAS target \"", libName,
- "\" because target \"", aliasedName,
- "\" is imported but not globally visible."));
- return false;
- }
- mf.AddAlias(libName, aliasedName);
+ mf.AddAlias(libName, aliasedName,
+ !aliasedTarget->IsImported() ||
+ aliasedTarget->IsImportedGloballyVisible());
return true;
}