{
  "id": "cmake/fetchcontent-already-populated",
  "signature": "CMake Error: FetchContent: Content for 'googletest' has already been populated. Use FETCHCONTENT_FULLY_DISCONNECTED or clear the population directory.",
  "signature_zh": "CMake 错误：FetchContent：'googletest' 的内容已经被填充。请使用 FETCHCONTENT_FULLY_DISCONNECTED 或清除填充目录。",
  "regex": "FetchContent: Content for '[^']+' has already been populated",
  "domain": "cmake",
  "category": "build_error",
  "subcategory": null,
  "root_cause": "FetchContent is called multiple times for the same dependency (e.g., in different subdirectories) without proper guards, or a previous configure left stale population state.",
  "root_cause_type": "generic",
  "root_cause_zh": "FetchContent 被多次调用（例如在不同子目录中）未加适当保护，或之前的配置留下了过时的填充状态。",
  "versions": [
    {
      "version": "CMake 3.14+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "googletest 1.12.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Delete the build directory and reconfigure from scratch",
      "why_fails": "Temporary fix; if the root cause (duplicate FetchContent calls) isn't fixed, it will happen again on next clean configure.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "Add set(FETCHCONTENT_FULLY_DISCONNECTED ON) globally",
      "why_fails": "This prevents any new downloads but may cause stale content if the dependency version changes.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    },
    {
      "action": "Wrap each FetchContent_Declare in if(NOT <name>_POPULATED) but forget to call FetchContent_MakeAvailable",
      "why_fails": "Missing MakeAvailable means the content isn't populated; the error persists.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "In CMakeLists.txt, guard FetchContent calls: if(NOT googletest_POPULATED) FetchContent_Declare(googletest ...) FetchContent_MakeAvailable(googletest) endif().",
      "success_rate": 0.95,
      "how": "In CMakeLists.txt, guard FetchContent calls: if(NOT googletest_POPULATED) FetchContent_Declare(googletest ...) FetchContent_MakeAvailable(googletest) endif().",
      "condition": "",
      "sources": []
    },
    {
      "action": "Clean the FetchContent population directory: rm -rf _deps/googletest* in the build directory, then reconfigure.",
      "success_rate": 0.85,
      "how": "Clean the FetchContent population directory: rm -rf _deps/googletest* in the build directory, then reconfigure.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use OVERRIDE_FIND_PACKAGE option in FetchContent_Declare to let find_package handle it: FetchContent_Declare(googletest GIT_REPOSITORY ... OVERRIDE_FIND_PACKAGE).",
      "success_rate": 0.8,
      "how": "Use OVERRIDE_FIND_PACKAGE option in FetchContent_Declare to let find_package handle it: FetchContent_Declare(googletest GIT_REPOSITORY ... OVERRIDE_FIND_PACKAGE).",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "在 CMakeLists.txt 中保护 FetchContent 调用：if(NOT googletest_POPULATED) FetchContent_Declare(googletest ...) FetchContent_MakeAvailable(googletest) endif()。",
    "清理 FetchContent 填充目录：在构建目录中执行 rm -rf _deps/googletest*，然后重新配置。",
    "在 FetchContent_Declare 中使用 OVERRIDE_FIND_PACKAGE 选项让 find_package 处理：FetchContent_Declare(googletest GIT_REPOSITORY ... OVERRIDE_FIND_PACKAGE)。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://cmake.org/cmake/help/latest/module/FetchContent.html",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.88,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2023-11-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}