Skip to content

Instantly share code, notes, and snippets.

@kitswas
Last active December 12, 2025 20:50
Show Gist options
  • Select an option

  • Save kitswas/db43543c07e88cafefabe3a51ba4df5a to your computer and use it in GitHub Desktop.

Select an option

Save kitswas/db43543c07e88cafefabe3a51ba4df5a to your computer and use it in GitHub Desktop.
Qt Kit support for CMake VSCode

Qt Kit support for CMake VSCode

How to add a kit

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.

Benefits

  1. You no longer need to edit CMake Cache variables like CMAKE_PREFIX_PATH or QT_DIR every time you have to configure a Qt project.
  2. You can have multiple Qt configurations (complier and Qt installation combinations) ready for use and switch with a few clicks.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment