question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[question] How to choose which cmake version to use for build()?

See original GitHub issue
  • conan install .. --build missing
  • Centos 7 (cmake is defaulted to cmake2)

How can I change the command to use?

Adding conan_cmake_program = cmake3 # environment CONAN_CMAKE_PROGRAM (overrides the make program used in CMake.cmake_program) in conan.conf didn’t change anything, it still uses cmake.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
czoidocommented, Aug 1, 2022

Hi @alexisfrjp,

In that case, you can try to prepend a path to the PATH where you create a symbolink link to the cmake3 binary and then add a [buildenv] section to your profile. For example:

mkdir ~/cmake3_symfolder
ln -s /usr/bin/cmake3 ~/cmake3_symfolder/cmake

Add the buildenv section to your profile, the folder will be prepended to the path each time Conan invokes the build() method (the (path) keyword stands for the current PATH variable):

[settings]
...
[buildenv]
PATH=+(path)~/cmake3_symfolder

Be aware that you have to set: tools.env.virtualenv:auto_use=True configuration so that this is automatically applied to the build. You can do that in the command line:

conan create . --profile=./<profile_with_buildenv> -c tools.env.virtualenv:auto_use=True

or adding it to the global.conf file.

Hope this helps.

1reaction
czoidocommented, Aug 1, 2022

Hi @alexisfrjp,

Be aware that the CONAN_CMAKE_PROGRAM environment variable does not work with the new integrations that are imported from the module conan, just for the old one that is imported from the module conans (note the extra ‘s’). So if you have in your recipe something like “from conan.tools.cmake import CMake” that may be the reason that the variable is not affecting the cmake run by build().

Anyway, at Conan level, what you can do is use a tool_requires in your profile, so that it will affect all the packages that need to be built. You can do that by adding setting something like:

[tool_requires]
cmake/3.23.2

Conan Center Index has CMake packages for versions that vary from 3.15, to 3.23, so you can select the one that is more adequate for you.

Hope this helps.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[question] How to properly specify cmake version as ... - GitHub
I am learning how to use the build_requires, for example, as described in this webinar. I have cmake 3.18.2 installed locally.
Read more >
CMake: how to specify the version of Visual C++ to work with?
First you can check what generators your CMake version does support (and how they are named): > cmake.exe --help ... The following generators...
Read more >
CMake 3.25.1 Documentation
To build a software project with CMake, Generate a Project Buildsystem. Optionally use cmake to Build a Project, Install a Project or just...
Read more >
Common Problems and Solutions – More Modern CMake
Solution: Either set a high minimum version or use the version range feature and CMake 3.12 or better. The lowest version you should...
Read more >
Get started with CMake Tools on Linux - Visual Studio Code
Open the Command Palette (Ctrl+Shift+P) and run CMake: Select a Kit. The extension will automatically scan for kits on your computer and create...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found