Conan在运行”conan install”时返回”ERROR: Invalid generator ‘cmake'”错误。

huangapple go评论52阅读模式
英文:

Conan returning "ERROR: Invalid generator 'cmake'" when running conan install

问题

在我的C++项目中运行以下脚本时:

cd cmake-build-debug/ || return
rm -rf conanBuild/
mkdir conanBuild && cd conanBuild
conan install ../.. --build=missing

我收到了错误消息:

错误:无效的生成器 'cmake'。可用类型:CMakeToolchain、CMakeDeps、MesonToolchain、MSBuildDeps、MSBuildToolchain、NMakeToolchain、NMakeDeps、VCVars、QbsProfile、VirtualRunEnv、VirtualBuildEnv、AutotoolsDeps、AutotoolsToolchain、PkgConfigDeps、BazelDeps、BazelToolchain、IntelCC、XcodeDeps、XcodeToolchain、PremakeDeps

这之前正常运行,但在运行brew命令安装不同的软件包后,brew还更新了所有现有的软件包,包括conan。似乎无法降级,因为运行 brew search conan 时只返回一个版本。

即使文档明确表示这应该正常工作。

因为我在Google上没有找到相关信息,所以我来这里寻求帮助。

有人知道这里可能出了什么问题吗?

版本:

conan:稳定 2.0.2
cmake:稳定 3.26.0
Homebrew 4.0.9
英文:

When running the following script in my c++ project:

cd cmake-build-debug/ || return
rm -rf conanBuild/
mkdir conanBuild && cd conanBuild
conan install ../.. --build=missing

I get the error message

ERROR: Invalid generator 'cmake'. Available types: CMakeToolchain, CMakeDeps, MesonToolchain, MSBuildDeps, MSBuildToolchain, NMakeToolchain, NMakeDeps, VCVars, QbsProfile, VirtualRunEnv, VirtualBuildEnv, AutotoolsDeps, AutotoolsToolchain, PkgConfigDeps, BazelDeps, BazelToolchain, IntelCC, XcodeDeps, XcodeToolchain, PremakeDeps

This used to run just fine, but after running a brew command to install a different package, brew also updated all my existing packages, including conan. I seemingly cant downgrade as brew only returns one version when running brew search conan.

Even the docs clearly state that this should work.

As I couldnt find anything related to this when googling I'm coming here for help.

Does anyone know what the problem here may be?

Versions:

conan: stable 2.0.2
cmake: stable 3.26.0
Homebrew 4.0.9

答案1

得分: 2

你正在链接到Conan 1.X文档(1位于URL中)

页面顶部还有一个绿色横幅,上面写着:

> 此文档适用于“1.X” Conan版本。单击此处查看Conan 2.0文档

你正在使用的版本是2.0.2,文档位于https://docs.conan.io/2/(或https://docs.conan.io)。在Conan 1.X中,“cmake”生成器已经被“CMakeDeps” + “CMakeToolchain”所取代,而在Conan 2.0中已完全删除。

如果“brew”版本是问题的话,我建议从pip安装,类似这样:“pip install conan==1.59”

英文:

You are linking Conan 1.X docs (the 1 is in the URL)

You also have a green banner in the top of the page that reads:

> This document is for a "1.X" Conan version. Click here to see the Conan 2.0 documentation

The version you are using is 2.0.2 the docs are in https://docs.conan.io/2/ (or https://docs.conan.io). The cmake generator has been superseded long time ago in Conan 1.X in favor of CMakeDeps + CMakeToolchain and it has been completely removed in Conan 2.0

If the brew version is the problem, I'd suggest installing it from pip instead, something like pip install conan==1.59

huangapple
  • 本文由 发表于 2023年3月21日 03:13:09
  • 转载请务必保留本文链接:https://go.coder-hub.com/75794398-2.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定