diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2021-04-25 12:22:09 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@gmail.com> | 2021-04-28 17:44:25 (GMT) |
commit | 46896d98bb8ed8a1068da70220581f8bbc3847fc (patch) | |
tree | 690472b077e8863afabc0647e909b52a8e32f02d /Help/command | |
parent | 49c6d0f26199c252b493ed5f816dbcb2e9701112 (diff) | |
download | CMake-46896d98bb8ed8a1068da70220581f8bbc3847fc.zip CMake-46896d98bb8ed8a1068da70220581f8bbc3847fc.tar.gz CMake-46896d98bb8ed8a1068da70220581f8bbc3847fc.tar.bz2 |
foreach(): loop variables are only available in the loop scope
Fixes: #20553
Diffstat (limited to 'Help/command')
-rw-r--r-- | Help/command/foreach.rst | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Help/command/foreach.rst b/Help/command/foreach.rst index 8de6deb..d9f54ca 100644 --- a/Help/command/foreach.rst +++ b/Help/command/foreach.rst @@ -14,9 +14,12 @@ semicolon or whitespace. All commands between ``foreach`` and the matching ``endforeach`` are recorded without being invoked. Once the ``endforeach`` is evaluated, the recorded list of commands is invoked once for each item in ``<items>``. -At the beginning of each iteration the variable ``loop_var`` will be set +At the beginning of each iteration the variable ``<loop_var>`` will be set to the value of the current item. +The scope of ``<loop_var>`` is restricted to the loop scope. See policy +:policy:`CMP0124` for details. + The commands :command:`break` and :command:`continue` provide means to escape from the normal control flow. |