VSCode+CMake+vcpkg
vcpkg
https://github.com/microsoft/vcpkg
使用PowerShell执行Vcpkg工程目录下的“bootstrap-vcpkg.bat”命令,即可编译。
vcpkg search package_name //搜索对应名称的包 vcpkg list //列出已经安装的包 vcpkg install pakage_name //安装对应的包 vcpkg remove pakage_name //删除对应的包 //例 vcpkg install eigen3:x64-windows vcpkg install opencv:x64-windows vcpkg integrate install
完整示例
注意:本例使用MinGW会报错,使用MSVC编译正常
例2:
可以编写vcpkg.json指定依赖的第三方库版本
{ "name": "demo", "version": "1.0.0", "dependencies": ["fmt"], "overrides":[ { "name":"fmt", "version>=":"7.1.0" } ], "builtin-baseline":"8b62f6fff30c4321945f1e498d85929285d7083a" }
MinGW安装