接到个新项目,用到很多三方库,从对接的同事那了解到vcpkg这个工具,周末试用了下,确实很方便,以前需要自己动手的源码下载,编译和打包安装,如今一个vcpkg install就能一站解决,十分便利,vcpkg的构建系统包含CMake,自己在用vcpkg搭建项目的时候遇到了些问题,一时搜索无法解决,最后回去补了些CMake的基础,再回来用vcpkg,才终于走顺,这里把实验的过程特此记录。
用的项目例子为Helloworld程序引用fmt库,测试环境Windows10, 目录结构如下:
PS D:\CodeDraft\helloworld> tree /F
卷 开发 的文件夹 PATH 列表
卷序列号为 BE68-723D
D:.
│ CMakeLists.txt
│ main.cpp
│ run_cmake.ps1
│
├─3rdparty
│ └─fmt_x64-mingw-dynamic
│ │ BUILD_INFO
│ │ CONTROL
│ │
│ ├─bin
│ │ libfmt.dll
│ │
│ ├─debug
│ │ ├─bin
│ │ │ libfmtd.dll
│ │ │
│ │ └─lib
│ │ │ libfmtd.dll.a
│ │ │
│ │ └─pkgconfig
│ │ fmt.pc
│ │
│ ├─include
│ │ └─fmt
vcpkg的下载过程可参考:https://www.cnblogs.com/linuxAndMcu/p/14696542.html
建项目过程,首先新建个helloworld文件夹
mkdir helloworld
cd helloworld
然后main.cpp如下
#include <fmt/core.h>
int main()
{
fmt

1839

被折叠的 条评论
为什么被折叠?



