Managing Packages with vcpkg

The experimental vcpkg plugin integrates the vcpkg C/C++ package manager into Qt Creator. It's available on all the supported development platforms.

You can use Qt Creator to create and edit vcpkg.json files to specify packages to build as part of your project when using CMake as the build system.

Enabling the vcpkg Plugin

To enable the vcpkg plugin:

  1. Select Help > About Plugins > Utilities > Vcpkg to enable the plugin.
  2. Select Restart Now to restart Qt Creator and load the plugin.

Setting vcpkg Preferences

By default, vcpkg is automatically set up for use with CMake. To disable automatic setup, select Edit > Preferences > CMake > General > Package manager auto setup.

{General tab in CMake Preferences}

To set the Path to the directory where you installed vcpkg, select Edit > Preferences > CMake > Vcpkg.

{Vcpkg tab in CMake Preferences}

Select to download vcpkg if you have not installed it yet.

Creating vcpkg Manifest Files

To create a new vcpkg package manager manifest (vcpkg.json) file:

  1. Select File > New File > Vcpkg.

    {vcpkg.json Manifest File wizard page}

  2. In Name, enter a name for the manifest file.
  3. In Version, enter a version number for the file.
  4. In Dependencies, enter the packages to manage.

    You can add packages later in a manifest editor.

  5. Select Next to open the Project Management page.
  6. Select Finish to create the file.

The wizard automatically adds the vcpkg.json file to the CMakeLists.txt file of the project.

Selecting Packages to Manage

When you open a vcpkg.json file, it opens in the manifest file editor:

{vcpkg.json file in the manifest file editor}

To add a package to your project:

  1. Place the cursor on the line where you want to add a package.
  2. Select the (Search Package) button.

    {Package selector dialog}

  3. Select the package to add to your project.
  4. Select OK to return to the editor.
  5. Repeat to add more packages.

To set the path to the directory where you installed vcpkg, select (Configure) on the editor toolbar.

© 2023 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.