mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-29 02:19:18 -05:00
Merge topic 'fix-flow-control-override' into release-3.20
c017098d4d CMake: Allow override of unexpected non-flow-control commands
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6232
This commit is contained in:
@@ -164,36 +164,36 @@ void GetScriptingCommands(cmState* state)
|
||||
state->AddBuiltinCommand("string", cmStringCommand);
|
||||
state->AddBuiltinCommand("unset", cmUnsetCommand);
|
||||
|
||||
state->AddUnexpectedCommand(
|
||||
state->AddUnexpectedFlowControlCommand(
|
||||
"else",
|
||||
"An ELSE command was found outside of a proper "
|
||||
"IF ENDIF structure. Or its arguments did not match "
|
||||
"the opening IF command.");
|
||||
state->AddUnexpectedCommand(
|
||||
state->AddUnexpectedFlowControlCommand(
|
||||
"elseif",
|
||||
"An ELSEIF command was found outside of a proper "
|
||||
"IF ENDIF structure.");
|
||||
state->AddUnexpectedCommand(
|
||||
state->AddUnexpectedFlowControlCommand(
|
||||
"endforeach",
|
||||
"An ENDFOREACH command was found outside of a proper "
|
||||
"FOREACH ENDFOREACH structure. Or its arguments did "
|
||||
"not match the opening FOREACH command.");
|
||||
state->AddUnexpectedCommand(
|
||||
state->AddUnexpectedFlowControlCommand(
|
||||
"endfunction",
|
||||
"An ENDFUNCTION command was found outside of a proper "
|
||||
"FUNCTION ENDFUNCTION structure. Or its arguments did not "
|
||||
"match the opening FUNCTION command.");
|
||||
state->AddUnexpectedCommand(
|
||||
state->AddUnexpectedFlowControlCommand(
|
||||
"endif",
|
||||
"An ENDIF command was found outside of a proper "
|
||||
"IF ENDIF structure. Or its arguments did not match "
|
||||
"the opening IF command.");
|
||||
state->AddUnexpectedCommand(
|
||||
state->AddUnexpectedFlowControlCommand(
|
||||
"endmacro",
|
||||
"An ENDMACRO command was found outside of a proper "
|
||||
"MACRO ENDMACRO structure. Or its arguments did not "
|
||||
"match the opening MACRO command.");
|
||||
state->AddUnexpectedCommand(
|
||||
state->AddUnexpectedFlowControlCommand(
|
||||
"endwhile",
|
||||
"An ENDWHILE command was found outside of a proper "
|
||||
"WHILE ENDWHILE structure. Or its arguments did not "
|
||||
|
||||
+8
-1
@@ -480,7 +480,7 @@ void cmState::AddDisallowedCommand(std::string const& name,
|
||||
|
||||
void cmState::AddUnexpectedCommand(std::string const& name, const char* error)
|
||||
{
|
||||
this->AddFlowControlCommand(
|
||||
this->AddBuiltinCommand(
|
||||
name,
|
||||
[name, error](std::vector<cmListFileArgument> const&,
|
||||
cmExecutionStatus& status) -> bool {
|
||||
@@ -495,6 +495,13 @@ void cmState::AddUnexpectedCommand(std::string const& name, const char* error)
|
||||
});
|
||||
}
|
||||
|
||||
void cmState::AddUnexpectedFlowControlCommand(std::string const& name,
|
||||
const char* error)
|
||||
{
|
||||
this->FlowControlCommands.insert(name);
|
||||
this->AddUnexpectedCommand(name, error);
|
||||
}
|
||||
|
||||
bool cmState::AddScriptedCommand(std::string const& name, BT<Command> command,
|
||||
cmMakefile& mf)
|
||||
{
|
||||
|
||||
@@ -166,6 +166,8 @@ public:
|
||||
void AddDisallowedCommand(std::string const& name, BuiltinCommand command,
|
||||
cmPolicies::PolicyID policy, const char* message);
|
||||
void AddUnexpectedCommand(std::string const& name, const char* error);
|
||||
void AddUnexpectedFlowControlCommand(std::string const& name,
|
||||
const char* error);
|
||||
bool AddScriptedCommand(std::string const& name, BT<Command> command,
|
||||
cmMakefile& mf);
|
||||
void RemoveBuiltinCommand(std::string const& name);
|
||||
|
||||
Reference in New Issue
Block a user