修改 CMakeLists.txt 文件,增加 Boost 的 regex 组件

This commit is contained in:
Tian jianyong 2025-02-06 17:31:43 +08:00
parent f72c744d27
commit c7c76c3933

View File

@ -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
)
#