CMP0130 — CMake 4.1.4 Documentation

# CMP0130

Added 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. It may be set by `cmake_policy()` or `cmake_minimum_required()`. If it is not set, CMake warns, and uses `OLD` behavior.

Note

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