The OLD behaviors of all policies are deprecated, but only by
documentation. Add an explicit deprecation diagnostic for policies
introduced in CMake 3.21 and below to encourage projects to port
away from setting policies to OLD.
- fix the typo in `foreach` documentation
- fix broken `foreach(... IN ITEMS ... LISTS ...)`
- add tests of `foreach` for existed functionality and fixes
Add test for a case fixed by commit 6a4a61d9e1 (cmForEachCommand:
prevent leakage, 2017-10-09). Prior to that fix, this test case
could trigger an assertion failure.
Fixes: #17464