# CMake Error: CMake Error in CMakeLists.txt: Unknown CMake command "cmake_policy".

- **ID:** `cmake/missing-cmake-policies-package`
- **Domain:** cmake
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 87%

## Root Cause

The cmake_policy command is used incorrectly (e.g., misspelled, wrong case, or called before cmake_minimum_required) or CMake version is too old to support it.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| CMake 2.8 | active | — | — |
| CMake 3.5 | active | — | — |
| CMake 3.20 | active | — | — |

## Workarounds

1. **Ensure cmake_minimum_required(VERSION 3.0) is placed before any cmake_policy calls. Example: cmake_minimum_required(VERSION 3.0) then cmake_policy(SET CMP0000 NEW).** (95% success)
   ```
   Ensure cmake_minimum_required(VERSION 3.0) is placed before any cmake_policy calls. Example: cmake_minimum_required(VERSION 3.0) then cmake_policy(SET CMP0000 NEW).
   ```
2. **Check for typos: use cmake_policy (lowercase, underscore) not cmakepolicy or CMakePolicy. Correct syntax: cmake_policy(VERSION 3.0).** (90% success)
   ```
   Check for typos: use cmake_policy (lowercase, underscore) not cmakepolicy or CMakePolicy. Correct syntax: cmake_policy(VERSION 3.0).
   ```
3. **If using an old CMake version, upgrade to at least 3.0, or use conditional code: if(CMAKE_VERSION VERSION_GREATER 2.6) cmake_policy(...) endif().** (85% success)
   ```
   If using an old CMake version, upgrade to at least 3.0, or use conditional code: if(CMAKE_VERSION VERSION_GREATER 2.6) cmake_policy(...) endif().
   ```

## Dead Ends

- **** — cmake_policy was introduced in CMake 2.6; if cmake_minimum_required is set to a lower version, the command may be unrecognized. (90% fail)
- **** — cmake_policy is a built-in command, not a variable; using set() with it creates a variable that does nothing. (100% fail)
