{
  "id": "cmake/imported-location-not-set",
  "signature": "CMake Error: IMPORTED_LOCATION not set for imported target \"MyPackage::MyLib\"",
  "signature_zh": "CMake 错误：未为导入目标 \"MyPackage::MyLib\" 设置 IMPORTED_LOCATION",
  "regex": "IMPORTED_LOCATION not set for imported target",
  "domain": "cmake",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "An imported target created via add_library(MyPackage::MyLib UNKNOWN IMPORTED) or similar lacks the IMPORTED_LOCATION property, which is required for linking.",
  "root_cause_type": "generic",
  "root_cause_zh": "通过 add_library(MyPackage::MyLib UNKNOWN IMPORTED) 或类似方式创建的导入目标缺少 IMPORTED_LOCATION 属性，而该属性是链接所必需的。",
  "versions": [
    {
      "version": "CMake 3.22",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "CMake 3.23",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "CMake 3.24",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "CMake requires a non-empty path; an empty string causes the same error or undefined behavior.",
      "fail_rate": 1.0,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The property name must match exactly; misspelling leads to the same error.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "add_library(MyPackage::MyLib UNKNOWN IMPORTED)\nset_target_properties(MyPackage::MyLib PROPERTIES\n  IMPORTED_LOCATION \"/usr/local/lib/libmylib.so\"\n)",
      "success_rate": 0.95,
      "how": "add_library(MyPackage::MyLib UNKNOWN IMPORTED)\nset_target_properties(MyPackage::MyLib PROPERTIES\n  IMPORTED_LOCATION \"/usr/local/lib/libmylib.so\"\n)",
      "condition": "",
      "sources": []
    },
    {
      "action": "# In MyPackageConfig.cmake:\nadd_library(MyPackage::MyLib UNKNOWN IMPORTED)\nset_target_properties(MyPackage::MyLib PROPERTIES\n  IMPORTED_LOCATION \"${CMAKE_CURRENT_LIST_DIR}/lib/libmylib.so\"\n)",
      "success_rate": 0.9,
      "how": "# In MyPackageConfig.cmake:\nadd_library(MyPackage::MyLib UNKNOWN IMPORTED)\nset_target_properties(MyPackage::MyLib PROPERTIES\n  IMPORTED_LOCATION \"${CMAKE_CURRENT_LIST_DIR}/lib/libmylib.so\"\n)",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "add_library(MyPackage::MyLib UNKNOWN IMPORTED)\nset_target_properties(MyPackage::MyLib PROPERTIES\n  IMPORTED_LOCATION \"/usr/local/lib/libmylib.so\"\n)",
    "# In MyPackageConfig.cmake:\nadd_library(MyPackage::MyLib UNKNOWN IMPORTED)\nset_target_properties(MyPackage::MyLib PROPERTIES\n  IMPORTED_LOCATION \"${CMAKE_CURRENT_LIST_DIR}/lib/libmylib.so\"\n)"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://cmake.org/cmake/help/latest/prop_tgt/IMPORTED_LOCATION.html",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.9,
  "fix_success_rate": 0.95,
  "resolvable": "true",
  "first_seen": "2023-09-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}