{
  "id": "cmake/source-file-not-found-alternate-extensions",
  "signature": "CMake Error: Cannot find source file: /path/to/src/module.cpp. Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx .f .f90 .F .F90 .s .S .asm",
  "signature_zh": "CMake 错误：找不到源文件：/path/to/src/module.cpp。已尝试扩展名 .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx .f .f90 .F .F90 .s .S .asm",
  "regex": "CMake Error: Cannot find source file: .+ Tried extensions",
  "domain": "cmake",
  "category": "build_error",
  "subcategory": null,
  "root_cause": "The source file listed in add_executable() or add_library() does not exist on disk. Common causes: file was moved, renamed, deleted, or the path is relative to a wrong directory.",
  "root_cause_type": "generic",
  "root_cause_zh": "add_executable() 或 add_library() 中列出的源文件在磁盘上不存在。常见原因：文件被移动、重命名、删除，或路径相对于错误的目录。",
  "versions": [
    {
      "version": "3.20",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.22",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.24",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.26",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.28",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The stale CMake cache may still reference the old path, causing the same error. A full reconfigure is needed.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The error is about a missing source file, not about target existence. Adding to another target doesn't create the missing file.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "If the file doesn't exist on disk, no extension change will help. The file must be present and the path must match exactly.",
      "fail_rate": 0.75,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Verify the file exists at the exact path. Use absolute paths or correct relative paths from CMAKE_CURRENT_SOURCE_DIR. Example:\n  set(MY_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/module.cpp)\n  add_executable(myapp ${MY_SRC})",
      "success_rate": 0.9,
      "how": "Verify the file exists at the exact path. Use absolute paths or correct relative paths from CMAKE_CURRENT_SOURCE_DIR. Example:\n  set(MY_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/module.cpp)\n  add_executable(myapp ${MY_SRC})",
      "condition": "",
      "sources": []
    },
    {
      "action": "If the file was moved, update the CMakeLists.txt to point to the new location. Run 'cmake --build . --clean-first' after fixing.",
      "success_rate": 0.85,
      "how": "If the file was moved, update the CMakeLists.txt to point to the new location. Run 'cmake --build . --clean-first' after fixing.",
      "condition": "",
      "sources": []
    },
    {
      "action": "If using generated files, ensure they are generated before the target is defined. Use add_custom_command with OUTPUT and add the output to the target's sources.",
      "success_rate": 0.8,
      "how": "If using generated files, ensure they are generated before the target is defined. Use add_custom_command with OUTPUT and add the output to the target's sources.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "验证文件是否存在于确切路径。使用绝对路径或从 CMAKE_CURRENT_SOURCE_DIR 开始的正确相对路径。示例：\n  set(MY_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/module.cpp)\n  add_executable(myapp ${MY_SRC})",
    "如果文件已被移动，更新 CMakeLists.txt 指向新位置。修复后运行 'cmake --build . --clean-first'。",
    "如果使用生成的文件，确保在定义目标之前生成它们。使用带 OUTPUT 的 add_custom_command，并将输出添加到目标的源文件中。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://cmake.org/cmake/help/latest/command/add_executable.html",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.88,
  "fix_success_rate": 0.85,
  "resolvable": "true",
  "first_seen": "2023-04-12",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}