Protobuf 3.6.1 VS2015 编译方法
1.下载解压安装CMake
2.打开VS2015 x86本机工具命令提示符
3.cd 到解压目录 cmake目录下
4.执行 mkdir build & cd build
5.执行 mkdir debug & cd debug
6.执行 cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Debug -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_BUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=../../../../install ../..
默认是静态库 -Dprotobuf_BUILD_SHARED_LIBS=ON 为动态库开关,若编译静态去掉即可,-Dprotobuf_BUILD_TESTS=OFF 测试开关
7.执行 nmake
8.执行 nmake install 完成
编译 Release 命令
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_BUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=../../../../install ../..