C++ VSCode CMake VCPKG:未启用清单文件

5

我试图像这个视频中一样构建Supertux-C++-Project

我安装了C++和CMake的VS Code扩展程序,并使用GCC编译器。我克隆了VCPKG存储库并执行了bootstrap-vcpkg.bat。之后,我运行了./vcpkg integrate install,并收到以下消息:

为此vcpkg根应用了用户范围内的集成。

.vscode\settings.json看起来像:

{
    "cmake.configureSettings": {
        "CMAKE_TOOLCHAIN_FILE": "D:/_programming/_repos/vcpkg/scripts/buildsystems/vcpkg.cmake",
        "VCPKG_BUILD": "ON",
    }
}

然后我在我的Supertux项目文件夹中创建了一个vcpkg.json文件,并插入所需的库:

{
    "name": "supertux-example",
    "version": "0.0.1",
    "dependencies": [
        "sdl2",
        "sdl2-image",
        "openal-soft",
        "curl",
        "libogg",
        "libvorbis",
        "freetype",
        "glew",
        "boost-date-time",
        "boost-filesystem",
        "boost-format",
        "boost-locale",
        "boost-system"
    ]
}

现在我尝试使用命令访问所有这些库: D:\_programming\_repos\vcpkg\vcpkg.exe install --triplet "x64-windows" --binarycaching 但是我收到以下错误信息:

Warning: manifest-root detected at D:/_programming/cpp/supertux, but manifests are not enabled.
If you wish to use manifest mode, you may do one of the following:
    * Add the `manifests` feature flag to the comma-separated environment
      variable `VCPKG_FEATURE_FLAGS`.
    * Add the `manifests` feature flag to the `--feature-flags` option.
    * Pass your manifest directory to the `--x-manifest-root` option.
If you wish to silence this error and use classic mode, you can:
    * Add the `-manifests` feature flag to `VCPKG_FEATURE_FLAGS`.
    * Add the `-manifests` feature flag to `--feature-flags`.
Error: 'install' requires at least 1 arguments, but 0 were provided

有人可以告诉我如何激活清单模式并解释一下这个错误的具体原因吗?(我在C++项目中使用外部库方面没有太多经验。)

1个回答

4

清单是vcpkg的一个相对较新的功能。它允许您通过vcpkg.json文件指定您的依赖关系。旧的方式意味着vcpkg无法从查看您的项目文件夹中自动知道您的依赖项。您必须基本上手动安装它们。

清单模式默认未启用。可以通过定义环境变量VCPKG_FEATURE_FLAGS=manifests来启用它。也可以在直接调用vcpkg时启用:D:\_programming\_repos\vcpkg\vcpkg.exe install --feature-flags=manifests,binarycaching --triplet "x64-windows"


感谢您的快速回复。 只是为了完全理解:环境变量也可以在settings.json文件中定义吗? - R3t

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接