{
  "id": "cmake/target-sources-file-not-found",
  "signature": "CMake Error: Cannot find source file: /path/to/src/main.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",
  "signature_zh": "CMake 错误：找不到源文件：/path/to/src/main.cpp。已尝试扩展名 .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx .f .f90 .F .F90",
  "regex": "CMake Error: Cannot find source file: .* Tried extensions .*",
  "domain": "cmake",
  "category": "build_error",
  "subcategory": null,
  "root_cause": "The source file specified in target_sources() or add_executable() does not exist on disk at the given path.",
  "root_cause_type": "generic",
  "root_cause_zh": "在 target_sources() 或 add_executable() 中指定的源文件在给定路径上不存在。",
  "versions": [
    {
      "version": "CMake 3.10",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "CMake 3.16",
      "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"
    },
    {
      "version": "CMake 3.27",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Adding the file with a different extension like .cpp vs .cc or .cxx in the CMakeLists.txt",
      "why_fails": "CMake does not automatically rename files; the file must physically exist with the exact name listed. Changing the extension only works if the actual file matches.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "Removing the target and re-adding without the missing file, assuming it's optional",
      "why_fails": "If the file is required for compilation, removing it will cause linker errors later. This only works if the file is genuinely unused.",
      "fail_rate": 0.75,
      "condition": "",
      "sources": []
    },
    {
      "action": "Using an absolute path that includes the build directory instead of source directory",
      "why_fails": "CMake expects source files relative to the source tree, not build tree. Using build directory paths causes confusion and does not fix the missing file.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Verify the file exists at the exact path specified. Use ${CMAKE_CURRENT_SOURCE_DIR} for relative paths to avoid ambiguity.",
      "success_rate": 0.9,
      "how": "Verify the file exists at the exact path specified. Use ${CMAKE_CURRENT_SOURCE_DIR} for relative paths to avoid ambiguity.",
      "condition": "",
      "sources": []
    },
    {
      "action": "If the file was moved or renamed, update the CMakeLists.txt to match the new location or name.",
      "success_rate": 0.85,
      "how": "If the file was moved or renamed, update the CMakeLists.txt to match the new location or name.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use file(GLOB ...) to automatically collect source files, but note this is discouraged for production builds due to missing dependency tracking.",
      "success_rate": 0.7,
      "how": "Use file(GLOB ...) to automatically collect source files, but note this is discouraged for production builds due to missing dependency tracking.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Verify the file exists at the exact path specified. Use ${CMAKE_CURRENT_SOURCE_DIR} for relative paths to avoid ambiguity.",
    "If the file was moved or renamed, update the CMakeLists.txt to match the new location or name.",
    "Use file(GLOB ...) to automatically collect source files, but note this is discouraged for production builds due to missing dependency tracking."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://cmake.org/cmake/help/latest/command/target_sources.html",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.88,
  "resolvable": "true",
  "first_seen": "2023-06-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}