Skip to content
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

Moving forward: Upcoming priorities for CMake Presets support #4117

Open
sinemakinci1 opened this issue Oct 9, 2024 · 6 comments
Open

Moving forward: Upcoming priorities for CMake Presets support #4117

sinemakinci1 opened this issue Oct 9, 2024 · 6 comments
Labels
enhancement an enhancement to the product that is either not present or an improvement to an existing feature Feature: presets
Milestone

Comments

@sinemakinci1
Copy link
Contributor

Brief Issue Summary

The CMake Tools extension maintainers plan to prioritize efforts towards support for CMake presets-based experiences opposed to CMake kits-based experiences.

Our recommendation is to use CMake presets for your CMake projects, as this is the recommended integration from Kitware themselves, allows for cross-platform and easily reproducible builds, and has first-class integration into our extension. Due to this, we plan to prioritize work items and PRs that are compliant with presets moving forward to best support our recommended scenario.

If you are using CMake Kits and Variants for your builds, please let us know if there is any gap that is preventing you from onboarding to presets so that we can best serve you. Would you like better documentation? Are there things you like about the Kits experience in general that leads you to prefer it?

Feel free to leave any comments or concerns on this issue so we can discuss!

CMake Tools Diagnostics

No response

Debug Log

No response

Additional Information

No response

@github-project-automation github-project-automation bot moved this to Blocked in CMake Tools Oct 9, 2024
@sinemakinci1 sinemakinci1 pinned this issue Oct 9, 2024
@github-actions github-actions bot added the triage label Oct 9, 2024
@gcampbell-msft gcampbell-msft added enhancement an enhancement to the product that is either not present or an improvement to an existing feature and removed triage labels Oct 9, 2024
@gcampbell-msft gcampbell-msft moved this from Blocked to Pending Prioritization in CMake Tools Oct 9, 2024
@gcampbell-msft gcampbell-msft added this to the Backlog milestone Oct 21, 2024
@zoink47
Copy link

zoink47 commented Nov 7, 2024

Hi,

we are heavily relying on the environmentSetupScript key in cmake-kits.json. It doesn't seem to exist in CMake Presets.

According to this issue over at the CMake project it seems to be intentionally left out: https://gitlab.kitware.com/cmake/cmake/-/issues/21619

The environmentSetupScript makes it really easy to use Yocto SDKs, since this the default way to use it with cmake tool chain files (sourcing the environment setup script for e.g. $CC and then using the cmake tool chain file): https://docs.yoctoproject.org/dev/sdk-manual/using.html#running-the-sdk-environment-setup-script

Unfortunately Yocto is lacking documentation on using the SDK with cmake, here is what I found:
https://patchwork.yoctoproject.org/project/oe-core/patch/[email protected]/

https://docs.yoctoproject.org/sdk-manual/working-projects.html

Sourcing the environment script from command line and then opening code from the terminal is also only partially solving the issue. We use the remote ssh/WSL extension a lot, and sourcing an environment before opening the remote/WSL session doesn't seem to be possible.

It would be great to somehow have the environmentSetupScript key available when used with CMake Presets, otherwise we still need to rely on CMake Kits (here is to hope that the cmake tools extension will not drop CMake Kits support).

Thanks in advance :)

@equeim
Copy link

equeim commented Dec 22, 2024

There should be better feedback about automatic setup of MSVC dev environment with presets. It took me a long time to figure out that I needed to set CMAKE_CXX_COMPILER to cl.exe explicitly in my CMakePresets.json for it to work. Since this is not needed for typical command line / CI workflows where you set up the environment manually (and rely on CMake to correctly guess that you want to compile with MSVC), some help from IDE is desirable here.

@melak47
Copy link
Contributor

melak47 commented Dec 31, 2024

There should be better feedback about automatic setup of MSVC dev environment with presets. It took me a long time to figure out that I needed to set CMAKE_CXX_COMPILER to cl.exe explicitly in my CMakePresets.json for it to work. Since this is not needed for typical command line / CI workflows where you set up the environment manually (and rely on CMake to correctly guess that you want to compile with MSVC), some help from IDE is desirable here.

I ran into similar problems (with conan-generated CMakePresets.json that do not set CMAKE_CXX_COMPILER, because it's being set in a toolchain file).

From what I can tell, Visual Studio and even JetBrains CLion do not need "CMAKE_CXX_COMPILER": "cl" as an explicit hint in the preset to provide the MSVC environment setup, just the toolset/architecture keys are enough.

Would it be possible to drop this requirement in cmake-tools, reducing friction with presets authored by/for other tools/IDEs?

@sinemakinci1
Copy link
Contributor Author

@equeim @melak47 Thank you so much for your feedback, I have opened this issue for us to track your requests: #4225.

@gcampbell-msft
Copy link
Collaborator

@melak47 Does setting the "cmake.useVsDeveloperEnvironment" setting to "always" mitigate the issue you're hitting?

@melak47
Copy link
Contributor

melak47 commented Jan 7, 2025

Does setting the "cmake.useVsDeveloperEnvironment" setting to "always" mitigate the issue you're hitting?

@gcampbell-msft it does, thanks!
Though reading the description of that setting:

Selecting auto will only apply the Visual Studio environment when we detect a supported compiler (cl, clang, clang-cl, clang-cpp, clang++), or the Ninja generator is being used.

It seems like it doesn't work exactly as described, as I am using the Ninja generator (both in the preset as well as in the cmake.generator setting).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement an enhancement to the product that is either not present or an improvement to an existing feature Feature: presets
Projects
Status: Pending Prioritization
Development

No branches or pull requests

5 participants