首先保证微软的那一套编译工具安装了
编写CMakeLists.txt
cmake_minimum_required(VERSION 3.28)
project(boost_learn)
add_executable(server 12_async_tcp_service.cpp)
target_include_directories(server PUBLIC "D:\\tools\\gitee\\something\\libs\\include\\boost-1_86")
add_executable(client 12_async_tcp_client.cpp)
target_include_directories(client PUBLIC "D:\\tools\\gitee\\something\\libs\\include\\boost-1_86")
创建并进入一个build目录,执行 cmake ..
然后执行 msbuild boost_learn.sln
这个.sln
是根据CMakeLists.txt 里面的 project
来生成的。
然后就可以自动编译代码了。
从Linux转过来Windows上开发,不习惯一上来就打开一个巨无霸的东西,这种编译方式就比较方便。