windows vcpkg

Install vcpkg

https://github.com/microsoft/vcpkg#quick-start-windows

powershell 终端执行如下命令:

git clone https://github.com/microsoft/vcpkg
.\vcpkg\bootstrap-vcpkg.bat

Install Package

# To install the libraries for your project, run:
# This will install x86 libraries by default.
.\vcpkg\vcpkg install [packages to install]

 # To install x64, run:
 .\vcpkg\vcpkg install [package name]:x64-windows

Tab-Completion/Auto-Completion

https://github.com/microsoft/vcpkg#tab-completionauto-completion

vcpkg supports auto-completion of commands, package names, and options in both powershell and bash. To enable tab-completion in the shell of your choice, run:

> .\vcpkg integrate powershell

VS/MSBuild 项目 (用户范围的集成)

https://learn.microsoft.com/zh-cn/vcpkg/examples/installing-and-using-packages#msbuild

使用 vcpkg 的建议且最高效的方法是通过用户范围的集成,使系统可用于你生成的所有项目。 首次在给定计算机上使用时,用户范围的集成将提示管理员进行访问,但之后不再需要该集成,并且集成按用户进行配置。

PowerShell 终端执行:

PS D:\src\vcpkg> .\vcpkg integrate install
Applied user-wide integration for this vcpkg root.

All C++ projects can now #include any installed libraries.
Linking will be handled automatically.
Installing new libraries will make them instantly available.

需要重启 Visual Studio 或执行生成以使用更改更新 Intellisense。

现在只需在 Visual Studio 中使用“文件 -> 新建项目”,该库将自动可用。 对于 SQLite,可以尝试其  C/C++ 示例

若要删除用户的集成,可以使用 .\vcpkg integrate remove

Vcpkg with CLion

https://github.com/microsoft/vcpkg#vcpkg-with-clion

Open the Toolchains settings (File > Settings on Windows and Linux, CLion > Preferences on macOS), and go to the CMake settings (Build, Execution, Deployment > CMake). Finally, in CMake options, add the following line:

-DCMAKE_TOOLCHAIN_FILE=[vcpkg root]/scripts/buildsystems/vcpkg.cmake

You must add this line to each profile.

Install cppzmq package

.\vcpkg\vcpkg install cppzmq:x64-windows

To find and use cppzmq in CMakeLists.txt

if (WIN32)
find_package(cppzmq REQUIRED)
endif (WIN32)