全部。
\n我决定使用新的 cmake 宏来下载外部依赖项。\n我从 Catch2 库的文档中获取了示例代码。
\ninclude(FetchContent)\n\nFetchContent_Declare(\n Catch2\n GIT_REPOSITORY https://github.com/catchorg/Catch2.git\n GIT_TAG v2.13.4\n)\nFetchContent_GetProperties(Catch2)\nif(NOT Catch2_POPULATED)\n FetchContent_Populate(Catch2)\n add_subdirectory(${catch2_SOURCE_DIR} ${catch2_BINARY_DIR})\nendif()\nRun Code Online (Sandbox Code Playgroud)\n该解决方案效果很好,除了在我离线时重新启动 cmake 的能力(没有 wifi 和移动网络,只有我和我的笔记本电脑)。\n我收到以下错误:
\n[0/7] Performing update step for 'catch2-populate'\nfatal: \xc2\xabhttps://github.com/catchorg/Catch2.git/\xc2\xbb \xd0\xbd\xd0\xb5\xd0\xb4\xd0\xbe\xd1\x81\xd1\x82\xd1\x83\xd0\xbf\xd0\xbd\xd0\xbe: Could not resolve host: github.com\nCMake Error at /Users/evgeny.proydakov/repository/ihft/build/_deps/catch2-subbuild/catch2-populate-prefix/tmp/catch2-populate-gitupdate.cmake:97 (execute_process):\n execute_process failed command indexes:\n\n 1: "Child return code: 128"\n\nFAILED: catch2-populate-prefix/src/catch2-populate-stamp/catch2-populate-update \ncd /Users/evgeny.proydakov/repository/ihft/build/_deps/catch2-src && /usr/local/Cellar/cmake/3.20.1/bin/cmake -P /Users/evgeny.proydakov/repository/ihft/build/_deps/catch2-subbuild/catch2-populate-prefix/tmp/catch2-populate-gitupdate.cmake\nninja: build stopped: subcommand failed.\n\nCMake Error at /usr/local/Cellar/cmake/3.20.1/share/cmake/Modules/FetchContent.cmake:1012 (message):\n Build step for catch2 failed: 1\nCall Stack (most recent call first):\n /usr/local/Cellar/cmake/3.20.1/share/cmake/Modules/FetchContent.cmake:1141:EVAL:2 (__FetchContent_directPopulate)\n /usr/local/Cellar/cmake/3.20.1/share/cmake/Modules/FetchContent.cmake:1141 (cmake_language)\n /usr/local/Cellar/cmake/3.20.1/share/cmake/Modules/FetchContent.cmake:1184 (FetchContent_Populate)\n .cmake/icmake.cmake:46 (FetchContent_MakeAvailable)\n CMakeLists.txt:10 (include)\n\n-- Configuring incomplete, errors occurred!\nRun Code Online (Sandbox Code Playgroud)\n是否可以一次性下载依赖项,检查修订版本,而不是每次都尝试连接到远程服务器?
\n