CMP0124 — CMake 3.24.2 Documentation

# CMP0124

New in version 3.21.

When this policy is set to `NEW`, the scope of loop variables defined by the `foreach()` command is restricted to the loop only. They will be unset at the end of the loop.

The `OLD` behavior for this policy still clears the loop variables at the end of the loop, but does not unset them. This leaves them as defined, but empty.

This policy was introduced in CMake version 3.21. Use the `cmake_policy()` command to set it to `OLD` or `NEW` explicitly. Unlike many policies, CMake version 3.24.2 does not warn when the policy is not set and simply uses `OLD` behavior.

Note

The `OLD` behavior of a policy is `deprecated by definition` and may be removed in a future version of CMake.