summaryrefslogtreecommitdiff
path: root/Source/cmCommands.cxx
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2022-08-05 10:55:32 +0200
committerMarc Chevrier <marc.chevrier@gmail.com>2022-08-22 16:25:53 +0200
commit44a2f3f3324a608062eb7b88072c7640f80f4a5c (patch)
treebcb7ee5b371d05c71d76fb12214c0b82039fa2de /Source/cmCommands.cxx
parent604993248fdee0bec8ab8c74c1173c67496a7dfd (diff)
downloadcmake-44a2f3f3324a608062eb7b88072c7640f80f4a5c.tar.gz
Add new flow-control commands for variables and policies scopes management
Add block() and endblock() commands offering the capability to create new scopes for variables and/or policies. Fixes: #20171
Diffstat (limited to 'Source/cmCommands.cxx')
-rw-r--r--Source/cmCommands.cxx6
1 files changed, 6 insertions, 0 deletions
diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx
index 5e616b30d0..3bc4f0e791 100644
--- a/Source/cmCommands.cxx
+++ b/Source/cmCommands.cxx
@@ -14,6 +14,7 @@
#include "cmAddLibraryCommand.h"
#include "cmAddSubDirectoryCommand.h"
#include "cmAddTestCommand.h"
+#include "cmBlockCommand.h"
#include "cmBreakCommand.h"
#include "cmBuildCommand.h"
#include "cmCMakeLanguageCommand.h"
@@ -126,6 +127,7 @@ void GetScriptingCommands(cmState* state)
state->AddFlowControlCommand("macro", cmMacroCommand);
state->AddFlowControlCommand("return", cmReturnCommand);
state->AddFlowControlCommand("while", cmWhileCommand);
+ state->AddFlowControlCommand("block", cmBlockCommand);
state->AddBuiltinCommand("cmake_language", cmCMakeLanguageCommand);
state->AddBuiltinCommand("cmake_minimum_required", cmCMakeMinimumRequired);
@@ -198,6 +200,10 @@ void GetScriptingCommands(cmState* state)
"An ENDWHILE command was found outside of a proper "
"WHILE ENDWHILE structure. Or its arguments did not "
"match the opening WHILE command.");
+ state->AddUnexpectedFlowControlCommand(
+ "endblock",
+ "An ENDBLOCK command was found outside of a proper "
+ "BLOCK ENDBLOCK structure.");
#if !defined(CMAKE_BOOTSTRAP)
state->AddBuiltinCommand("cmake_host_system_information",