Search code examples
c++cmakepackage-managersconan

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


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

Solution

  • 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