{
  "schemaVersion": "ebb.rule.v1",
  "id": "cpp.cmake.policy-below-3.5.removed",
  "ecosystem": "cpp",
  "purl": "pkg:generic/cmake",
  "affectedVersions": "vers:semver/<3.5.0",
  "event": "removed",
  "severity": "high",
  "title": "CMake policy versions older than 3.5 are removed",
  "summary": "CMake 4.0 removed compatibility with policy versions older than 3.5. A cmake_minimum_required(VERSION) or cmake_policy(VERSION) call that does not set the policy version to at least 3.5 (optionally via ...<policy_max>) produces an error on CMake 4.0 and newer. CMake 4.0.0 was published on 2025-03-27.",
  "replacement": "cmake_minimum_required(VERSION 3.5) or newer, or VERSION <min>...<max> with <max> at least 3.5",
  "deadline": "2025-03-27",
  "sources": [
    {
      "title": "CMake 4.0 release notes (compatibility older than 3.5 removed)",
      "url": "https://cmake.org/cmake/help/latest/release/4.0.html",
      "accessedAt": "2026-10-19"
    },
    {
      "title": "cmake_minimum_required (Changed in 4.0)",
      "url": "https://cmake.org/cmake/help/latest/command/cmake_minimum_required.html",
      "accessedAt": "2026-10-19"
    },
    {
      "title": "CMake 4.0.0 GitHub release",
      "url": "https://github.com/Kitware/CMake/releases/tag/v4.0.0",
      "accessedAt": "2026-10-19"
    }
  ],
  "provenance": {
    "observedAt": "2026-10-19",
    "reviewedAt": "2026-10-19",
    "reviewer": "arminazimi"
  },
  "migration": {
    "constraints": [
      "Raising the policy version can change NEW policy behavior; read the policies introduced between the old and new floor before committing.",
      "Projects that must still configure on older CMake can use VERSION <min>...<max> so the minimum stays low while the policy max is at least 3.5 on newer CMake."
    ],
    "steps": [
      {
        "id": "raise-cmake-policy-floor",
        "title": "Raise the reported cmake_minimum_required policy version",
        "instructions": "Change the reported cmake_minimum_required(VERSION …) so the effective policy version is at least 3.5 (for example VERSION 3.16, or VERSION 2.8.12...3.16).",
        "targets": "declaration"
      }
    ],
    "verification": [
      {
        "command": "cmake -S . -B build",
        "purpose": "Configure the project with a CMake 4.x toolchain and confirm the policy floor is accepted."
      }
    ]
  }
}
