Skip to content

Commit f1bb712

Browse files
committed
updating documentation
1 parent 6dcc8be commit f1bb712

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

docs/kits.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ A _kit_ defines project-agnostic and configuration-agnostic info about how to bu
66
- A Visual Studio installation: building for Visual Studio involves more than just finding the necessary compiler executable. Visual C++ requires certain environment variables to be set to tell it how to find and link to the Visual C++ toolchain headers and libraries.
77
- A toolchain file: The low-level way to instruct CMake how to compile and link for a target. CMake Tools handles toolchain files using kits.
88

9-
Kits are mostly CMake-generator-agnostic (a CMake generator writes the input files for the native build system). Visual Studio kits have a preferred generator that will be used as a fallback to ensure a matching MSBuild and .sln generator are used for the Visual C++ compiler.
9+
Kits are mostly CMake-generator-agnostic (a CMake generator writes the input files for the native build system). The exception is Visual Studio kits: when you [scan for kits](#scan-for-kits), CMake Tools looks up the VS version and sets `preferredGenerator` on the kit to the matching CMake generator (e.g., `"Visual Studio 18 2026"` for VS 2026). This only happens at scan time. If a kit was scanned before CMake Tools knew about that VS version, the kit won't have a `preferredGenerator` and will fall through to whatever default generator is available (usually Ninja).
1010

1111
> **Note:**
12-
> * If you use the [Ninja](https://ninja-build.org/) build system, don't worry about Visual Studio CMake Generators. CMake Tools will prefer Ninja if it is present, unless configured otherwise.
12+
> * If you use the [Ninja](https://ninja-build.org/) build system, don't worry about Visual Studio CMake Generators. CMake Tools will prefer Ninja if it is present, unless configured otherwise. A Visual Studio kit without `preferredGenerator` will just use Ninja.
1313
> * If you change the active kit while a project is configured, the project configuration will be re-generated with the chosen kit.
14+
> * When the selected generator doesn't match what's already in an existing `CMakeCache.txt`, CMake Tools cleans the prior configuration instead of letting CMake error out.
1415
> * Using a kit is recommended but optional. If you don't use a kit, CMake will perform its own automatic detection.
1516
1617
## How kits are found and defined
@@ -52,7 +53,7 @@ Update [user-local kits](#user-local-kits) by running **Scan for Kits** from the
5253

5354
- CMake tools includes `vswhere.exe`, which it uses to find Visual Studio instances installed on the system.
5455

55-
- For each of `x86`, `amd64`, `x86_amd64`, `x86_arm`, `x86_arm64`, `amd64_x86`, `amd64_arm`, and `amd64_arm64`, CMake Tools checks for installed Visual C++ environments. A kit is generated for each existing MSVC toolchain that is found.
56+
- For each of `x86`, `amd64`, `x86_amd64`, `x86_arm`, `x86_arm64`, `amd64_x86`, `amd64_arm`, and `amd64_arm64`, CMake Tools checks for installed Visual C++ environments. A kit is generated for each existing MSVC toolchain that is found. For known VS versions (2019, 2022, 2026, etc.), the kit gets a `preferredGenerator` pointing at the right CMake generator, like `"Visual Studio 18 2026"`. If CMake Tools doesn't recognize the VS version yet, `preferredGenerator` is left unset and the kit will use Ninja or whatever default is available.
5657

5758
**3. Save results to the user-local kits file**
5859

@@ -147,7 +148,14 @@ The following additional options may be specified:
147148

148149
`preferredGenerator`
149150

150-
> The CMake generator that should be used with this kit if not the default. CMake Tools will still search in `cmake.preferredGenerators` from `settings.json`, but will fall back to this option if no generator from the user settings is available
151+
> The CMake generator to use with this kit if not the default. For Visual Studio kits, this is set during [kit scanning](#scan-for-kits) based on the VS version. When picking a generator, CMake Tools checks these in order:
152+
>
153+
> 1. `cmake.generator` from your settings (wins over everything else)
154+
> 2. `cmake.preferredGenerators` from your settings
155+
> 3. The kit's `preferredGenerator` (set at scan time for VS kits)
156+
> 4. Fallback: Ninja, then Unix Makefiles
157+
>
158+
> If your kit doesn't have a `preferredGenerator` (maybe it was scanned before CMake Tools added support for that VS version), it will just use the fallback. Re-running **Scan for Kits** will pick up the correct generator.
151159
152160
`cmakeSettings`
153161

0 commit comments

Comments
 (0)