Conan: How to use a different version of CMAKE

Created on 11 Dec 2018  路  5Comments  路  Source: conan-io/conan

Hello,

I'm evaluating various package managers and have just started evaluating Conan. I made a simple executable with a dependency.

Building the dependency I error CMake 3.0 or higher is required. You are running version 2.8.12.2

I ran conan install cmake_installer/3.9.0@conan/stable it downloaded and installed the new cmake.

But how do tell Conan to use this one instead of system one to build my dependency. I looked a long time for simple issue but cannot figure out how to make this work with out altering my system globally.

Thanks

-Ivan

question

All 5 comments

Hi @IvanMCalderon

There are a few possible ways:

  • Declare a build_require in your conanfile. Possible but strongly discouraged.
  • Declare a build_require in your profile. Profiles are recommended, this would be a nice way, and done in one single command: https://docs.conan.io/en/latest/devtools/build_requires.html#declaring-build-requirements. Profiles can also be shared with conan config install
  • Install independently, with a virtualrunenv generator (https://docs.conan.io/en/latest/mastering/virtualenv.html#virtualrunenv-generator and https://docs.conan.io/en/latest/devtools/running_packages.html#using-virtual-environments), then activate the environment so that cmake is now in the path, now every command (conan or not) that you run in that environment, will use that cmake.

Completing your above command:

$ conan install cmake_installer/3.9.0@conan/stable -g virtualrunenv
$ source activate_run.sh # or run activate_run.bat in Windows
$ cmake --version

But please do have a look to profiles, that might help even more automatically.

Please tell me if this help or if you have any further question. Thanks!

Yes, this works. Thank you for the profiles suggestion. I'm now reading and learning about that solution.

-Ivan

Hi @memsharded
I don't have cmake in my PC.
And I want to use conan to install cmake 3.17 for me to compile conan packages.
I add cmake_installer under [build_requires] of profile, as following:

[build_requires]
cmake_installer/3.16.3@conan/stable

But in conan-center, all cmake versions are smaller than 3.17.
How can I resolve it?
Thanks!

Hi @memsharded
I don't have cmake in my PC.
And I want to use conan to install cmake 3.17 for me to compile conan packages.
I add cmake_installer under [build_requires] of profile, as following:

[build_requires]
cmake_installer/3.16.3@conan/stable

But in conan-center, all cmake versions are smaller than 3.17.
How can I resolve it?
Thanks!

@beizhengren cmake_installer is deprecated. Please use cmake/3.17.4 instead.

@uilianries Thanks for your advice.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mpdelbuono picture mpdelbuono  路  3Comments

theodelrieu picture theodelrieu  路  3Comments

bobeff picture bobeff  路  3Comments

rconde01 picture rconde01  路  3Comments

niosHD picture niosHD  路  3Comments