{
  "id": "cmake/cpack-component-version-mismatch",
  "signature": "CMake Error: CPack component \"runtime\" has version 1.0.0 but component \"headers\" has version 2.0.0. All components must have the same version.",
  "signature_zh": "CMake 错误：CPack 组件 \"runtime\" 的版本为 1.0.0，但组件 \"headers\" 的版本为 2.0.0。所有组件必须具有相同的版本。",
  "regex": "CPack component \".*\" has version [0-9.]+ but component \".*\" has version [0-9.]+",
  "domain": "cmake",
  "category": "install_error",
  "subcategory": null,
  "root_cause": "When using CPack with components, each component's version must match the project version; a mismatch occurs when CPACK_COMPONENT_<compName>_VERSION is set inconsistently across components.",
  "root_cause_type": "generic",
  "root_cause_zh": "当使用带有组件的 CPack 时，每个组件的版本必须与项目版本匹配；当跨组件不一致地设置 CPACK_COMPONENT_<compName>_VERSION 时会发生不匹配。",
  "versions": [
    {
      "version": "CMake 3.10",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "CMake 3.18",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "CPack 3.20",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Deleting all CPACK_COMPONENT_*_VERSION variables",
      "why_fails": "Removing version specifications from all components may default to the project version, but CPack may still fail if any component has an explicit version set elsewhere.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "Setting only CPACK_PACKAGE_VERSION without adjusting component versions",
      "why_fails": "Setting a global CPACK_PACKAGE_VERSION may not override component-specific versions, leading to persistent mismatches.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "Disabling component grouping in CPack",
      "why_fails": "Using CPack without components (GROUPING IGNORE) may suppress the error but creates a monolithic package that defeats the purpose of component-based installation.",
      "fail_rate": 0.75,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Set all component versions to the same value, e.g., `set(CPACK_COMPONENT_RUNTIME_VERSION \"2.0.0\")` and `set(CPACK_COMPONENT_HEADERS_VERSION \"2.0.0\")` to match the project version.",
      "success_rate": 0.9,
      "how": "Set all component versions to the same value, e.g., `set(CPACK_COMPONENT_RUNTIME_VERSION \"2.0.0\")` and `set(CPACK_COMPONENT_HEADERS_VERSION \"2.0.0\")` to match the project version.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Remove explicit version settings for components and rely on the project version by not setting any CPACK_COMPONENT_*_VERSION variables.",
      "success_rate": 0.85,
      "how": "Remove explicit version settings for components and rely on the project version by not setting any CPACK_COMPONENT_*_VERSION variables.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use `set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE ON)` to combine all components into a single package, bypassing version checks.",
      "success_rate": 0.8,
      "how": "Use `set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE ON)` to combine all components into a single package, bypassing version checks.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "将所有组件版本设置为相同值，例如 `set(CPACK_COMPONENT_RUNTIME_VERSION \"2.0.0\")` 和 `set(CPACK_COMPONENT_HEADERS_VERSION \"2.0.0\")` 以匹配项目版本。",
    "移除组件的显式版本设置，通过不设置任何 CPACK_COMPONENT_*_VERSION 变量来依赖项目版本。",
    "使用 `set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE ON)` 将所有组件合并到一个包中，绕过版本检查。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://cmake.org/cmake/help/latest/module/CPackComponent.html",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.81,
  "fix_success_rate": 0.85,
  "resolvable": "true",
  "first_seen": "2024-05-18",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}