CMP0130 — CMake 3.28.3 Documentation

# CMP0130

New in version 3.24.

`while()` diagnoses condition evaluation errors.

CMake 3.23 and below accidentally tolerated errors encountered while evaluating the condition passed to the `while()` command (but not the `if()` command). For example, the code

    set(paren "(")
    while(${paren})
    endwhile()

creates an unbalanced parenthesis during condition evaluation.

CMake 3.24 and above prefer to diagnose such errors. This policy provides compatibility for projects that have not been updated to fix their condition errors.

The `OLD` behavior for this policy is to ignore errors in `while()` conditions. The `NEW` behavior for this policy is to diagnose errors in `while()` conditions.

This policy was introduced in CMake version 3.24. CMake version 3.28.3 warns when the policy is not set and uses `OLD` behavior. Use the `cmake_policy()` command to set it to `OLD` or `NEW` explicitly.

Note

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