diff options
author | Nils Gladitz <nilsgladitz@gmail.com> | 2013-11-16 10:07:24 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2013-11-19 14:44:22 (GMT) |
commit | 3900fcf4a8eee24141e2d562c1b6b796b456c838 (patch) | |
tree | 5f0ffc818922b71848c91bb3fa29bcde63cacc93 /Source/cmAddExecutableCommand.cxx | |
parent | 958367e10cee44d2dbce72f9393168746099ebd1 (diff) | |
download | CMake-3900fcf4a8eee24141e2d562c1b6b796b456c838.zip CMake-3900fcf4a8eee24141e2d562c1b6b796b456c838.tar.gz CMake-3900fcf4a8eee24141e2d562c1b6b796b456c838.tar.bz2 |
CMP0037: Extend policy to reserved names and custom targets
Teach add_custom_target to check the policy too. Extend the policy to
disallow reserved target names that we use for builtin targets like
"all".
Extend the RunCMake.CMP0037 test to cover these cases.
Diffstat (limited to 'Source/cmAddExecutableCommand.cxx')
-rw-r--r-- | Source/cmAddExecutableCommand.cxx | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Source/cmAddExecutableCommand.cxx b/Source/cmAddExecutableCommand.cxx index a93e834..a352be0 100644 --- a/Source/cmAddExecutableCommand.cxx +++ b/Source/cmAddExecutableCommand.cxx @@ -69,7 +69,9 @@ bool cmAddExecutableCommand } } - bool nameOk = cmGeneratorExpression::IsValidTargetName(exename); + bool nameOk = cmGeneratorExpression::IsValidTargetName(exename) && + !cmGlobalGenerator::IsReservedTarget(exename); + if (nameOk && !importTarget && !isAlias) { nameOk = exename.find(":") == std::string::npos; @@ -95,7 +97,8 @@ bool cmAddExecutableCommand cmOStringStream e; e << (this->Makefile->GetPolicies() ->GetPolicyWarning(cmPolicies::CMP0037)) << "\n"; - e << "The target name \"" << exename << "\" is not valid for certain " + e << "The target name \"" << exename << + "\" 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()); |