{
  "id": "cmake/generic-platform-name-unknown",
  "signature": "CMake Error: Could not determine the platform name for CMAKE_SYSTEM_NAME = \"Generic\"",
  "signature_zh": "CMake 错误：无法确定 CMAKE_SYSTEM_NAME = \"Generic\" 的平台名称",
  "regex": "CMake Error: Could not determine the platform name for CMAKE_SYSTEM_NAME = \"[^\"]+\"",
  "domain": "cmake",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "CMake cannot find a valid platform file for the given system name; often occurs when using a custom toolchain file without specifying CMAKE_SYSTEM_NAME correctly.",
  "root_cause_type": "generic",
  "root_cause_zh": "CMake 无法为给定的系统名称找到有效的平台文件；通常发生在使用自定义工具链文件而未正确指定 CMAKE_SYSTEM_NAME 时。",
  "versions": [
    {
      "version": "cmake 3.26.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "cmake 3.27.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "cmake 3.28.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Set CMAKE_SYSTEM_NAME to \"Linux\" or \"Windows\" arbitrarily",
      "why_fails": "Forces a platform file that may not match the target environment, causing linker or compiler errors.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "Remove CMAKE_SYSTEM_NAME entirely",
      "why_fails": "CMake will auto-detect the host system, which defeats cross-compilation and may produce wrong binaries.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Create a custom platform file named 'Platform/Generic.cmake' in your project's cmake module path with minimal settings:\n\n# cmake/Platform/Generic.cmake\nset(CMAKE_SYSTEM_NAME Generic)\nset(CMAKE_C_COMPILER_WORKS TRUE)\nset(CMAKE_CXX_COMPILER_WORKS TRUE)\n\nThen set CMAKE_MODULE_PATH to include that directory.",
      "success_rate": 0.9,
      "how": "Create a custom platform file named 'Platform/Generic.cmake' in your project's cmake module path with minimal settings:\n\n# cmake/Platform/Generic.cmake\nset(CMAKE_SYSTEM_NAME Generic)\nset(CMAKE_C_COMPILER_WORKS TRUE)\nset(CMAKE_CXX_COMPILER_WORKS TRUE)\n\nThen set CMAKE_MODULE_PATH to include that directory.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use the existing 'Generic' platform by setting the toolchain file properly:\n\ncmake -DCMAKE_TOOLCHAIN_FILE=/path/to/toolchain.cmake -DCMAKE_SYSTEM_NAME=Generic /path/to/source\n\nEnsure toolchain.cmake sets CMAKE_SYSTEM_NAME to Generic.",
      "success_rate": 0.8,
      "how": "Use the existing 'Generic' platform by setting the toolchain file properly:\n\ncmake -DCMAKE_TOOLCHAIN_FILE=/path/to/toolchain.cmake -DCMAKE_SYSTEM_NAME=Generic /path/to/source\n\nEnsure toolchain.cmake sets CMAKE_SYSTEM_NAME to Generic.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "在项目的 cmake 模块路径中创建名为 'Platform/Generic.cmake' 的自定义平台文件，包含最小设置：\n\n# cmake/Platform/Generic.cmake\nset(CMAKE_SYSTEM_NAME Generic)\nset(CMAKE_C_COMPILER_WORKS TRUE)\nset(CMAKE_CXX_COMPILER_WORKS TRUE)\n\n然后设置 CMAKE_MODULE_PATH 指向该目录。",
    "通过正确设置工具链文件来使用现有的 'Generic' 平台：\n\ncmake -DCMAKE_TOOLCHAIN_FILE=/path/to/toolchain.cmake -DCMAKE_SYSTEM_NAME=Generic /path/to/source\n\n确保 toolchain.cmake 设置了 CMAKE_SYSTEM_NAME 为 Generic。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html#cross-compiling-with-toolchain-files",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.88,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-01-10",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}