In VSCode, run command: (Press Ctrl+Shift+P on Windows)
CMake: Edit User-Local CMake Kits
Add the following to the JSON file: (cmake-tools-kits.json)
{
"name": "Desktop Qt 6.8.0 MinGW 64-bit",
"compilers": {
"C": "D:/Qt/Tools/mingw1310_64/bin/gcc.exe",
"CXX": "D:/Qt/Tools/mingw1310_64/bin/g++.exe"
},
"isTrusted": true,
"environmentVariables": {
"VSCODE_QT_FOLDER": "D:/Qt/6.8.0/mingw_64"
},
"cmakeSettings": {
"CMAKE_PREFIX_PATH:FILEPATH": "D:/Qt/6.8.0/mingw_64",
"WINDEPLOYQT_EXECUTABLE:FILEPATH": "D:/Qt/6.8.0/mingw_64/bin/windeployqt.exe"
},
"preferredGenerator": {
"name": "Ninja"
}
},Change all the paths according to your system and save.
Add an entry for each Qt installation on your system.
The keys WINDEPLOYQT_EXECUTABLE:FILEPATH and preferredGenerator are optional.
- You no longer need to edit CMake Cache variables like
CMAKE_PREFIX_PATHorQT_DIRevery time you have to configure a Qt project. - You can have multiple Qt configurations (complier and Qt installation combinations) ready for use and switch with a few clicks.