microsoft / vscode-cmake-tools

CMake integration in Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=vector-of-bool.cmake-tools
MIT License
1.45k stars 443 forks source link

How to preconfigure the "unspecified" kit to be used? #1496

Open vadi2 opened 3 years ago

vadi2 commented 3 years ago

I'd like to preconfigure a kit to work out of the box with a new github codespaces instance so it doesn't ask every contributor every time - because the poorly named "unspecified" kit works just fine. Looked through the settings, but didn't find anything relevant. Did I miss it?

andreeis commented 3 years ago

Thank you for the idea. Indeed there is no setting for specifying a kit. The extension stores that information in the project 'state' which is not accessible directly to the user. We are going to implement something that would work for your scenario.

vadi2 commented 3 years ago

Thanks a lot!

emmenlau commented 2 years ago

This is something we would also need. We have a lot of external developers (working students) that work on pre-configured machines. They will run into all sorts of problems when they start messing with compiler settings. Therefore it would be great if in the project settings, we can pre-select the "unspecified" kit. This should make sure there is no popup to choose kits or compilers.

Thanks a lot for the consideration, this would be very valuable to us.

bobbrow commented 2 years ago

Kitware developed a configuration format called "CMake Presets" that would solve this problem for you. Migrating to presets removes the extension's dependency on Kits altogether. The CMakePresets.json file is intended to be committed to source control so everyone working on the project would be able to inherit it.

emmenlau commented 2 years ago

Thanks @bobbrow for the quick response! I can see how cmake presets are useful. But I am hesitant to adopt them, because our CI supports not only cmake but also autotools and some other (less common) build systems. For that reason we already maintain something that solves the same need as cmake presets, albeit more classical, with environment variables (like CC and CXX) and PATHs.

So for our needs, I would be more happy if we do not necessarily need to adopt another settings format (even such a promising one as cmake presets).

But how much cmake preset would be required to achieve the same as the "unspecified" kit does? Would an empty preset work? Or what is the "minimal acceptable preset"?

bobbrow commented 2 years ago

It all depends on how you configure your project on the command line and how many combinations of settings you want to support.

If you plan to support the 4 default CMAKE_BUILD_TYPE's with Ninja, the easiest thing to do is have 1 configurePreset with your common configurations in it, then derive 4 simple presets from it that just override the CMAKE_BUILD_TYPE (no buildPresets should be necessary). For a multi-config generator like Visual Studio, you would create 1 configurePreset with your common configurations, then 4 buildPresets that specify the CMAKE_BUILD_TYPE's.

github-actions[bot] commented 10 months ago

This issue is now marked as 'stale-old' due to there being no activity on it for the past 720 days. Unless the 'stale-old' label is removed or the issue is commented on, this will be remain open for at least 14 days and then it may be closed. If you would like to make this issue exempt from getting stale, please add the 'stale-exempt' label.