New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feature] configurePresets.cmakeExecutable in CMakePresets.json should be filled in #15427
Comments
Hi @Ext3h Thanks for your suggestion. |
Never mind the rambling about |
Okay, figured that out as well. But that's wrong... It's wrong in both Conan 1.x and 2.x, as far as I can tell. |
Yes, I think it would make sense to add that variable to our presets, I'll make some tests with that. |
What is your suggestion?
In
CMakePresets.json
, you can setconfigurePresets.cmakeExecutable
to set a specific CMake binary.While this doesn't work at alll with Visual Studio (stupid IDE insists on using built-in, outdated CMake version), it does work for IDEs like Visual Studio Code and similar ones.
This avoids a nasty issue when working a "hybrid" model between IDE with CMake integration mixed with conan commands in the same workspace.
Why you would want to do that?... E.g. because the initial configuration of the CMake cache is something which still behaves somewhat different between doing it within the IDE vs doing it in Conan. Stuff like environment variables required for compiler detection not being correctly set in the
CMakePresets.json
, and loads of other similar (environment related) issues.When you have such a workflow, and you are working in a setup where CMake is distributed as a Conan dependency (and not installed system wide like in Conan Center), then you end up with Conan and the IDE trying to use different CMake versions on the same cache with guaranteed conflicts.
Specifying the CMake version
conan
would use in the presets ensures that configuration of the workspace with Conan, but subsequent work without Conan is possible in the first place.While at it, also have a look at
configurePreset.environment
please, that's yet another thing Conan isn't filling in, leaving you in an odd situation where IDEs invoking CMake will do something entirely different from what Conan had prepared as an environment.Worst case they pick up an entirely different compiler toolchain. E.g. trying to use Ninja together with MSVC and VSCode is something which should work out of the box, but absolutely doesn't when Conan is in the mix so you have to start re-wire commands just to make sure at least VCVars is eventually called before CMake.
Have you read the CONTRIBUTING guide?
The text was updated successfully, but these errors were encountered: