clion配置cmake添加boost库

参考 https://blog.csdn.net/to_be_better/article/details/53967198
在CMakeLists.txt中的add_executable(…)前面加三行,后面加一行代码即可。

cmake_minimum_required(VERSION 3.12)
project(hello_world2)
set(CMAKE_CXX_STANDARD 14)

#boost库所在的根目录
set(BOOST_ROOT "/usr/local/include/boost")
#添加头文件搜索路径
include_directories(/usr/local/include)
#添加库文件搜索路径
link_directories(/usr/local/lib)

add_executable(。。。)

# 目标进行链接
target_link_libraries(hello_world2 boost_thread boost_system)

猜你喜欢

转载自blog.csdn.net/qq_32732581/article/details/87887491