Vcpkg VSCode CMake extension provides vcpkg integration in VSCode.
Please report any bugs in github.
Requirements
- VSCode >= 1.76.0
- CMake Tools extension >= 1.13.0
Usage
You can use Vcpkg getting start page to control vcpkg behavior.
for more options, please see Preferences
- Settings
- Extensions
- vcpkg
.
Also, you can manually control vcpkg behavior with the following commands:
Enable vcpkg integration
- Ctrl(⌘) + Shift + P
- Search vcpkg.
- Select
vcpkg: Enable vcpkg
:
a. Extension will automaticly enable vcpkg if you already set environment variable VCPKG_ROOT
or already set vcpkg path in settings.
b. Extension will automaticly enable vcpkg if vcpkg root folder was selected before.
c. Otherwise, please choose vcpkg root folder.
- Extension will select the triplet (dynamic) according to your system architecture, vcpkg toolchain will be added into cmake settings.
You can also enable/disable vcpkg in Preferences
- Settings
- Extensions
(in workspace
) - Vcpkg
.
Note: please only enable/disable in workspace
!
Disable vcpkg integration
- Ctrl(⌘) + Shift + P
- Search vcpkg.
- Select
vcpkg: Disable vcpkg
.
- vcpkg toolchain will be removed from cmake toolchain and other vcpkg setting will also be removed from cmake options.
Use static library
- Ctrl(⌘) + Shift + P
- Search vcpkg.
- Select
vcpkg: Use static library
.
Use dynamic library
- Ctrl(⌘) + Shift + P
- Search vcpkg.
- Select
vcpkg: Use dynamic library
.
Set target triplet
- Ctrl(⌘) + Shift + P
- Search vcpkg.
- Select
vcpkg: Set target triplet
.
- Enter your target triplet
Set host triplet
- Ctrl(⌘) + Shift + P
- Search vcpkg.
- Select
vcpkg: Set host triplet
.
- Enter your host triplet
Enable/Disable automatically update host/target triplet
- Open
Preferences
- Settings
- Extensions
(in workspace
) - Vcpkg
.
- Select/Unselect
Vcpkg › General: Auto Update Triplet
.
Set vcpkg additional install options
- Open
Preferences
- Settings
- Extensions
(in workspace
) - Vcpkg
.
- Add additional options one by one in
Vcpkg › Target: Additional Options
.
Enable/Disable install dependency binaries
- Open
Preferences
- Settings
- Extensions
(in workspace
) - Vcpkg
.
- Select/Unselect
Vcpkg › Target: Install Dependencies
.
Find system/vcpkg installed libraries first
- Open
Preferences
- Settings
- Extensions
(in workspace
) - Vcpkg
.
- Select/Unselect
Vcpkg › Target: Prefer System Libs
.
Version and builtin-baseline autocompletion in vcpkg manifest
- Enable vcpkg integration.
- Set vcpkg path.
- Autocompletion will be enabled automatically when typing
"
.
Debug portfile or other vcpkg provided cmake code
- Set breakpoint in the portfile.cmake (required) or other cmake file.
- Open
Run and Debug
in left side bar, select Debug portfile(s)
, click the green triangle to run debugging.
Debug port's CMake code
- Set breakpoint in the portfile.cmake.
- Run install command with
--editable
(important!) then set breakpoint in source cmake file(folder name without .clean
).
- Open
Run and Debug
in left side bar, select Debug portfile(s)
, click the green triangle to run debugging.