一、soci编译
1、修改CMakeLists.txt,配置mysql
if(CMAKE_CL_64)
set(MYSQL_DIR "H:/Others/mysql-8.0.22-winx64")
else()
set(MYSQL_DIR "H:/Others/mysql-8.0.22-winx32")
endif()
set(MYSQL_INCLUDE_DIR ${MYSQL_DIR}/include)
set(MYSQL_LIBRARIES ${MYSQL_DIR}/lib/libmysql.lib)
set(MYSQL_LIBRARY ${MYSQL_DIR}/lib)
2、编译
md build && cd build // 创建编译后存放路径
cmake ../ -DWITH_MYSQL=ON -DSOCI_MYSQL=ON // 默认编译成64位
cmake ../ -G "Visual Studio 16 2019" -A Win32 -DWITH_MYSQL=ON -DSOCI_MYSQL=ON // 编译32位
PS:安装路径设置 -DCMAKE_INSTALL_PREFIX=install_path
c++编译:-DSOCI_CXX11=ON
打开build目录下的SOCI.sln
编译生成soci库