修改 CMakeLists.txt 文件,增加 Boost 的 regex 组件
This commit is contained in:
parent
f72c744d27
commit
c7c76c3933
@ -6,9 +6,8 @@ if(NOT APPLE)
|
||||
set(CMAKE_CXX_COMPILER "/opt/rh/devtoolset-11/root/usr/bin/g++")
|
||||
endif()
|
||||
|
||||
# 设置 CMake 策略
|
||||
cmake_policy(SET CMP0074 NEW) # 使用 <PackageName>_ROOT 变量
|
||||
cmake_policy(SET CMP0167 NEW) # 使用新的 Boost 查找机制
|
||||
# 设置 CMake 策略(移除非必要的新策略)
|
||||
cmake_policy(SET CMP0074 NEW) # 保留必要的包根目录策略
|
||||
|
||||
# 包含 FetchContent 模块
|
||||
include(FetchContent)
|
||||
@ -51,6 +50,12 @@ else()
|
||||
set(BOOST_ROOT "/opt/homebrew/Cellar/boost/1.87.0")
|
||||
set(BOOST_LIBRARYDIR "/opt/homebrew/Cellar/boost/1.87.0/lib")
|
||||
endif()
|
||||
|
||||
# 设置 CMake 策略(在 find_package(Boost) 前添加)
|
||||
if(POLICY CMP0167)
|
||||
cmake_policy(SET CMP0167 OLD) # 强制使用传统 FindBoost 模块
|
||||
endif()
|
||||
|
||||
find_package(Boost 1.69.0 REQUIRED COMPONENTS
|
||||
system
|
||||
filesystem
|
||||
@ -58,6 +63,7 @@ find_package(Boost 1.69.0 REQUIRED COMPONENTS
|
||||
chrono
|
||||
date_time
|
||||
atomic
|
||||
regex # 添加缺失的 regex 组件
|
||||
)
|
||||
|
||||
# 添加 libcurl
|
||||
@ -121,6 +127,7 @@ target_link_libraries(${PROJECT_NAME}_lib
|
||||
nlohmann_json::nlohmann_json
|
||||
CURL::libcurl
|
||||
Threads::Threads
|
||||
-pthread # 添加显式 pthread 链接选项
|
||||
)
|
||||
|
||||
# 创建主可执行文件
|
||||
|
||||
Loading…
Reference in New Issue
Block a user