summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2023-10-27 13:32:48 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2023-10-27 13:42:53 (GMT)
commit8313d261984a372078576296385c349cac2168c5 (patch)
treee874b56e2f55bb4f781b609cc52779bb8dd68c62 /Source
parente3747a2d4be427e97af01ca1cce1c6641d4dff74 (diff)
downloadCMake-8313d261984a372078576296385c349cac2168c5.zip
CMake-8313d261984a372078576296385c349cac2168c5.tar.gz
CMake-8313d261984a372078576296385c349cac2168c5.tar.bz2
cmState::AddDisallowedCommand(): Allow additional warning info
Diffstat (limited to 'Source')
-rw-r--r--Source/cmState.cxx18
-rw-r--r--Source/cmState.h3
2 files changed, 14 insertions, 7 deletions
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index d41e8e5..8ae2166 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -447,17 +447,23 @@ void cmState::AddFlowControlCommand(std::string const& name,
void cmState::AddDisallowedCommand(std::string const& name,
BuiltinCommand command,
cmPolicies::PolicyID policy,
- const char* message)
+ const char* message,
+ const char* additionalWarning)
{
this->AddBuiltinCommand(
name,
- [command, policy, message](const std::vector<cmListFileArgument>& args,
- cmExecutionStatus& status) -> bool {
+ [command, policy, message,
+ additionalWarning](const std::vector<cmListFileArgument>& args,
+ cmExecutionStatus& status) -> bool {
cmMakefile& mf = status.GetMakefile();
switch (mf.GetPolicyStatus(policy)) {
- case cmPolicies::WARN:
- mf.IssueMessage(MessageType::AUTHOR_WARNING,
- cmPolicies::GetPolicyWarning(policy));
+ case cmPolicies::WARN: {
+ std::string warning = cmPolicies::GetPolicyWarning(policy);
+ if (additionalWarning) {
+ warning = cmStrCat(warning, '\n', additionalWarning);
+ }
+ mf.IssueMessage(MessageType::AUTHOR_WARNING, warning);
+ }
CM_FALLTHROUGH;
case cmPolicies::OLD:
break;
diff --git a/Source/cmState.h b/Source/cmState.h
index b79f3e6..702b06f 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -183,7 +183,8 @@ public:
void AddFlowControlCommand(std::string const& name, Command command);
void AddFlowControlCommand(std::string const& name, BuiltinCommand command);
void AddDisallowedCommand(std::string const& name, BuiltinCommand command,
- cmPolicies::PolicyID policy, const char* message);
+ cmPolicies::PolicyID policy, const char* message,
+ const char* additionalWarning = nullptr);
void AddUnexpectedCommand(std::string const& name, const char* error);
void AddUnexpectedFlowControlCommand(std::string const& name,
const char* error);