Details
-
Suggestion
-
Resolution: Fixed
-
Not Evaluated
-
Qt Creator 9.0.1
-
None
-
Windows 11
MSVC16 (VS2019), MSVC17 (VS2022)
Qt Creator 9.0.1
CMake 3.25.1
Ninja 1.11.1
-
-
e8802d92e (10.0), 6235d9b8c (11.0), fe8c276d1 (11.0)
Description
Suggestion
According to this article of Qt Blog, it is required to specify lots of environment variables in CMakePresets.json when using MSVC compilers with NMake Makefiles, Ninja, or Ninja Multi-Config generators.
However, we won't need to do so when using VSCode with CMake Tools extension. We can simply use the "external" strategy of "toolset" and "architecture" fields in CMakePresets.json, and then CMake Tools will autodetect which MSVC compiler should be used.
For example:
- If we want to use "MSVC16(VS2019) x64" compiler, then:
"generator": "Ninja Multi-Config", "toolset": { "value": "v142,host=x64", "strategy": "external" }, "architecture": { "value": "x64", "strategy": "external" },
- If we want to use "MSVC16(VS2019) x86" compiler, then
"generator": "Ninja Multi-Config", "toolset": { "value": "v142,host=x86", "strategy": "external" }, "architecture": { "value": "x86", "strategy": "external" },
- If we want to use "MSVC17(VS2022) x64_x86" compiler, then
"generator": "Ninja Multi-Config", "toolset": { "value": "v143,host=x64", "strategy": "external" }, "architecture": { "value": "x86", "strategy": "external" },
- If we want to use "MSVC17(VS2022) x86_x64" compiler, then
"generator": "Ninja Multi-Config", "toolset": { "value": "v143,host=x86", "strategy": "external" }, "architecture": { "value": "x64", "strategy": "external" },
I hope QtCreator can support this mechanism as well. Otherwise, it is inconvenient to specify so many hardcoded environment variables.