首页 > 解决方案 > CMake 错误 - 在 yuzu 生成器中使用柯南

问题描述

我正在使用 vs code 和 CMake 来生成 yuzu 项目,但是 CMakeList.txt 从第 127 行开始总是报告 conan 代码错误,并且我已经使用 pip 命令在 CMD 中安装了 conan。

Yuzu 项目和 CMakeList.txt

CMake 输出

[proc] run command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli "-Dcmake.cmakePath:STRING=C:/Program Files/CMake/bin/cmake" -Dcmake.configureOnOpen:BOOL=TRUE "-Dcmake.generator:STRING=MinGW Makefiles" -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -He:/Visual_Studio_Code/yuzu_emulator/yuzu -Be:/Visual_Studio_Code/yuzu_emulator/yuzu/build -G "Visual Studio 16 2019" -T host=x86 -A win32
[cmake] Not searching for unused variables given on the command line.
[cmake] -- Target architecture: x86
[cmake] -- Could NOT find Boost (missing: Boost_INCLUDE_DIR) (Required is at least version "1.71")
[cmake] -- Could NOT find Catch2 (missing: Catch2_INCLUDE_DIR Catch2_VERSION) (Required is at least version "2.11")
[cmake] -- Could NOT find fmt (missing: fmt_LIBRARY fmt_INCLUDE_DIR fmt_VERSION) (Required is at least version "6.2")
[cmake] -- Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY OPENSSL_INCLUDE_DIR) (Required is at least version "1.1")
[cmake] -- Could NOT find lz4 (missing: lz4_LIBRARY lz4_INCLUDE_DIR) (Required is at least version "1.8")
[cmake] -- Could NOT find nlohmann_json (missing: nlohmann_json_INCLUDE_DIR nlohmann_json_VERSION) (Required is at least version "3.7")
[cmake] -- Could NOT find opus (missing: opus_LIBRARY opus_INCLUDE_DIR) (Required is at least version "1.3")
[cmake] -- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR) (Required is at least version "1.2")
[cmake] -- Could NOT find zstd (missing: zstd_LIBRARY zstd_INCLUDE_DIR zstd_VERSION) (Required is at least version "1.4")
[cmake] CMake Warning at CMakeLists.txt:217 (find_package):
[cmake]   By not providing "FindQt5.cmake" in CMAKE_MODULE_PATH this project has
[cmake]   asked CMake to find a package configuration file provided by "Qt5", but
[cmake]   CMake did not find one.
[cmake] 
[cmake]   Could not find a package configuration file provided by "Qt5" (requested
[cmake]   version 5.9) with any of the following names:
[cmake] 
[cmake]     Qt5Config.cmake
[cmake]     qt5-config.cmake
[cmake] 
[cmake]   Add the installation prefix of "Qt5" to CMAKE_PREFIX_PATH or set "Qt5_DIR"
[cmake]   to a directory containing one of the above files.  If "Qt5" provides a
[cmake]   separate development package or SDK, be sure it has been installed.
[cmake] 
[cmake] 
[cmake] CMake Warning at CMakeLists.txt:229 (find_package):
[cmake]   By not providing "FindSDL2.cmake" in CMAKE_MODULE_PATH this project has
[cmake]   asked CMake to find a package configuration file provided by "SDL2", but
[cmake]   CMake did not find one.
[cmake] 
[cmake]   Could not find a package configuration file provided by "SDL2" with any of
[cmake]   the following names:
[cmake] 
[cmake]     SDL2Config.cmake
[cmake]     sdl2-config.cmake
[cmake] 
[cmake]   Add the installation prefix of "SDL2" to CMAKE_PREFIX_PATH or set
[cmake]   "SDL2_DIR" to a directory containing one of the above files.  If "SDL2"
[cmake]   provides a separate development package or SDK, be sure it has been
[cmake]   installed.
[cmake] 
[cmake] 
[cmake] -- Packages boost/1.72.0;catch2/2.11.0;fmt/6.2.0;openssl/1.1.1f;lz4/1.9.2;nlohmann_json/3.7.3;opus/1.3.1;zlib/1.2.11;zstd/1.4.4;qt/5.14.1@bincrafters/stable;sdl2/2.0.12@bincrafters/stable not found!
[cmake] -- Configuring incomplete, errors occurred!
[cmake] See also "E:/Visual_Studio_Code/yuzu_emulator/yuzu/build/CMakeFiles/CMakeOutput.log".
[cmake] See also "E:/Visual_Studio_Code/yuzu_emulator/yuzu/build/CMakeFiles/CMakeError.log".
[cmake] CMake Error at CMakeLists.txt:252 (conan_check):
[cmake]   Unknown CMake command "conan_check".

通常它的问题是 CMakeList.txt 文件无法运行有关柯南的代码并且 lib 无法自动下载,但是我该如何解决这个问题,兄弟??????该项目不提供柯南.cmake。我是一名网络开发人员,不熟悉 c++ proj 构造。

标签: c++cmakeconan

解决方案


yuzu 存储库的 CMakeLists.txt(在父目录中找到)需要 conan 1.24.0 版本,而最新的是 1.25.2。我假设您已经安装了最新版本。

将第 252 行从:

conan_check(VERSION 1.24.0 REQUIRED)

至:

conan_check(VERSION 1.25.2 REQUIRED)

它应该可以工作。

不要忘记删除构建文件夹中的 cmake 缓存。


推荐阅读