Linux command
vcpkg 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Search for a package
vcpkg search [package_name]
Install a package
vcpkg install [package_name]
Install package for specific triplet
vcpkg install [package_name]:[triplet]
List installed packages
vcpkg list
Remove a package
vcpkg remove [package_name]
Update vcpkg
vcpkg update
Integrate with system-wide MSBuild/CMake
vcpkg integrate install
Show package information
vcpkg search [package_name] --x-full-desc
说明
vcpkg is Microsoft's cross-platform C/C++ package manager for acquiring and managing library dependencies. It provides access to thousands of open-source libraries that can be built and integrated into projects on Windows, macOS, and Linux. Unlike system package managers, vcpkg allows multiple versions of the same library to coexist and supports cross-compilation through triplets. It integrates seamlessly with CMake and MSBuild, automatically configuring include paths and link libraries. Packages are built from source using curated build scripts (portfiles) maintained in the vcpkg registry. This ensures consistent builds across platforms and allows customization of build options. The tool can operate in classic mode with a central installation or manifest mode with per-project dependencies. Configuration is done through environment variables (VCPKG_ROOT, VCPKG_DEFAULT_TRIPLET) or command-line options.
参数
- search _pattern_
- Search for packages matching the pattern.
- install _package__:triplet_
- Install a package, optionally specifying a target triplet.
- remove _package_
- Remove an installed package.
- list
- List all installed packages.
- update
- Update vcpkg itself and refresh the package catalog.
- upgrade
- Rebuild all outdated packages.
- integrate install
- Enable system-wide integration with build systems.
- integrate remove
- Remove system-wide integration.
- export _package_ --zip|--nuget
- Export installed packages to a portable format.
- help _topic_
- Display help on a specific command or topic.
- --triplet _triplet_
- Specify target platform (e.g., x64-linux, x86-windows, arm64-osx).
- --disable-metrics
- Disable telemetry data collection.
FAQ
What is the vcpkg command used for?
vcpkg is Microsoft's cross-platform C/C++ package manager for acquiring and managing library dependencies. It provides access to thousands of open-source libraries that can be built and integrated into projects on Windows, macOS, and Linux. Unlike system package managers, vcpkg allows multiple versions of the same library to coexist and supports cross-compilation through triplets. It integrates seamlessly with CMake and MSBuild, automatically configuring include paths and link libraries. Packages are built from source using curated build scripts (portfiles) maintained in the vcpkg registry. This ensures consistent builds across platforms and allows customization of build options. The tool can operate in classic mode with a central installation or manifest mode with per-project dependencies. Configuration is done through environment variables (VCPKG_ROOT, VCPKG_DEFAULT_TRIPLET) or command-line options.
How do I run a basic vcpkg example?
Run `vcpkg search [package_name]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does search _pattern_ do in vcpkg?
Search for packages matching the pattern.