{
  "id": "cmake/policy-cmp0074-not-set-find-package",
  "signature": "CMake Error: Policy CMP0074 is not set: find_package uses <PackageName>_ROOT variables. Run \"cmake --help-policy CMP0074\" for policy details.",
  "signature_zh": "CMake 错误：未设置策略 CMP0074：find_package 使用 <PackageName>_ROOT 变量。运行 \"cmake --help-policy CMP0074\" 查看策略详情。",
  "regex": "CMake Error: Policy CMP0074 is not set: find_package uses <PackageName>_ROOT variables\\. Run \"cmake --help-policy CMP0074\" for policy details\\.",
  "domain": "cmake",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "CMake 3.12+ has a new policy CMP0074 that controls whether find_package honors <PackageName>_ROOT environment variables. If the policy is not set explicitly, CMake issues an error to force the developer to decide.",
  "root_cause_type": "generic",
  "root_cause_zh": "CMake 3.12+ 引入了新策略 CMP0074，用于控制 find_package 是否遵循 <PackageName>_ROOT 环境变量。如果未显式设置该策略，CMake 会报错以强制开发者决定。",
  "versions": [
    {
      "version": "cmake 3.12",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "cmake 3.15",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "cmake 3.20",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "cmake 3.25",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "CMAKE_POLICY_DEFAULT_CMP0074 is a variable, not a policy command. Must use cmake_policy(SET CMP0074 NEW) explicitly.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Without policy set, CMake will still error out. The policy must be set before find_package.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Policy CMP0074 exists in 3.12+; using an older version may suppress the error but also lose new features. Not a proper fix.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Add before any find_package call: cmake_policy(SET CMP0074 NEW) to enable the new behavior.",
      "success_rate": 0.95,
      "how": "Add before any find_package call: cmake_policy(SET CMP0074 NEW) to enable the new behavior.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Add cmake_policy(SET CMP0074 OLD) to use legacy behavior (ignore <PackageName>_ROOT).",
      "success_rate": 0.9,
      "how": "Add cmake_policy(SET CMP0074 OLD) to use legacy behavior (ignore <PackageName>_ROOT).",
      "condition": "",
      "sources": []
    },
    {
      "action": "Set cmake_minimum_required(VERSION 3.11) to avoid the policy entirely, but this may not be ideal for modern projects.",
      "success_rate": 0.85,
      "how": "Set cmake_minimum_required(VERSION 3.11) to avoid the policy entirely, but this may not be ideal for modern projects.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "在任何 find_package 调用之前添加：cmake_policy(SET CMP0074 NEW) 以启用新行为。",
    "添加 cmake_policy(SET CMP0074 OLD) 以使用旧行为（忽略 <PackageName>_ROOT）。",
    "设置 cmake_minimum_required(VERSION 3.11) 以完全避免该策略，但这可能不适用于现代项目。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://cmake.org/cmake/help/latest/policy/CMP0074.html",
  "official_doc_section": null,
  "error_code": "CMP0074",
  "verification_tier": "ai_generated",
  "confidence": 0.84,
  "fix_success_rate": 0.95,
  "resolvable": "true",
  "first_seen": "2023-04-05",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}