diff options
Diffstat (limited to 'Source/cmAddLibraryCommand.cxx')
-rw-r--r-- | Source/cmAddLibraryCommand.cxx | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx index e9c5d6b..0f98f35 100644 --- a/Source/cmAddLibraryCommand.cxx +++ b/Source/cmAddLibraryCommand.cxx @@ -109,7 +109,9 @@ bool cmAddLibraryCommand } } - bool nameOk = cmGeneratorExpression::IsValidTargetName(libName); + bool nameOk = cmGeneratorExpression::IsValidTargetName(libName) && + !cmGlobalGenerator::IsReservedTarget(libName); + if (nameOk && !importTarget && !isAlias) { nameOk = libName.find(":") == std::string::npos; @@ -135,7 +137,8 @@ bool cmAddLibraryCommand cmOStringStream e; e << (this->Makefile->GetPolicies() ->GetPolicyWarning(cmPolicies::CMP0037)) << "\n"; - e << "The target name \"" << libName << "\" is not valid for certain " + e << "The target name \"" << libName << + "\" is reserved or not valid for certain " "CMake features, such as generator expressions, and may result " "in undefined behavior."; this->Makefile->IssueMessage(messageType, e.str().c_str()); |