{
  "id": "cmake/export-import-target-not-found",
  "signature": "CMake Error: install(EXPORT \"MyTargets\") includes target \"mylib\" which is not in the export set.",
  "signature_zh": "CMake 错误：install(EXPORT \"MyTargets\") 包含目标 \"mylib\"，但该目标不在导出集中。",
  "regex": "install\\(EXPORT \"[^\"]+\"\\) includes target \"[^\"]+\" which is not in the export set",
  "domain": "cmake",
  "category": "install_error",
  "subcategory": null,
  "root_cause": "An install(EXPORT) command references a target that was not previously registered with install(TARGETS) and the same EXPORT name.",
  "root_cause_type": "generic",
  "root_cause_zh": "install(EXPORT) 命令引用的目标之前没有使用相同的 EXPORT 名称通过 install(TARGETS) 注册。",
  "versions": [
    {
      "version": "CMake 3.10",
      "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.22",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "CMake uses the EXPORT name to group targets; mismatched names cause the target to be omitted from the set.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Without the export, other projects cannot use find_package to locate the installed targets.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Ensure the target is installed with the same EXPORT name: install(TARGETS mylib EXPORT MyTargets DESTINATION lib). Then install(EXPORT MyTargets DESTINATION lib/cmake). Example: install(TARGETS mylib EXPORT MyTargets DESTINATION lib) and install(EXPORT MyTargets DESTINATION lib/cmake/MyProject).",
      "success_rate": 0.95,
      "how": "Ensure the target is installed with the same EXPORT name: install(TARGETS mylib EXPORT MyTargets DESTINATION lib). Then install(EXPORT MyTargets DESTINATION lib/cmake). Example: install(TARGETS mylib EXPORT MyTargets DESTINATION lib) and install(EXPORT MyTargets DESTINATION lib/cmake/MyProject).",
      "condition": "",
      "sources": []
    },
    {
      "action": "If the target should not be exported, remove it from the install(EXPORT) call or create a separate export set for it.",
      "success_rate": 0.85,
      "how": "If the target should not be exported, remove it from the install(EXPORT) call or create a separate export set for it.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "确保目标使用相同的 EXPORT 名称安装：install(TARGETS mylib EXPORT MyTargets DESTINATION lib)。然后 install(EXPORT MyTargets DESTINATION lib/cmake)。示例：install(TARGETS mylib EXPORT MyTargets DESTINATION lib) 和 install(EXPORT MyTargets DESTINATION lib/cmake/MyProject)。",
    "如果目标不应被导出，将其从 install(EXPORT) 调用中移除，或为其创建单独的导出集。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://cmake.org/cmake/help/latest/command/install.html#export",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.86,
  "fix_success_rate": 0.92,
  "resolvable": "true",
  "first_seen": "2023-12-12",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}