6 Evaluate a group of commands with a dedicated variable and/or policy scope.
10 block([SCOPE_FOR [POLICIES] [VARIABLES] ] [PROPAGATE <var-name>...])
14 All commands between ``block()`` and the matching :command:`endblock` are
15 recorded without being invoked. Once the :command:`endblock` is evaluated, the
16 recorded list of commands is invoked inside the requested scopes, then the
17 scopes created by the ``block()`` command are removed.
20 Specify which scopes must be created.
23 Create a new policy scope. This is equivalent to
24 :command:`cmake_policy(PUSH)`.
27 Create a new variable scope.
29 If ``SCOPE_FOR`` is not specified, this is equivalent to:
33 block(SCOPE_FOR VARIABLES POLICIES)
36 When a variable scope is created by the :command:`block` command, this
37 option sets or unsets the specified variables in the parent scope. This is
38 equivalent to :command:`set(PARENT_SCOPE)` or :command:`unset(PARENT_SCOPE)`
46 block(PROPAGATE var1 var2)
51 # Now var1 holds VALUE1, and var2 is unset
53 This option is only allowed when a variable scope is created. An error will
54 be raised in the other cases.
56 When the ``block()`` is inside a :command:`foreach` or :command:`while`
57 command, the :command:`break` and :command:`continue` commands can be used
65 # the break() command will terminate the while() command
76 * :command:`cmake_policy`