修改 CMakeLists.txt
This commit is contained in:
parent
cba55fcbd9
commit
15054a3f0c
@ -41,15 +41,11 @@ find_package(CURL REQUIRED)
|
||||
if(APPLE)
|
||||
# macOS 使用 Homebrew 安装的 nlohmann_json
|
||||
find_package(nlohmann_json 3.11.3 REQUIRED)
|
||||
set(JSON_TARGET nlohmann_json::nlohmann_json)
|
||||
else()
|
||||
# CentOS 使用系统安装的 json-devel
|
||||
set(JSON_INCLUDE_DIR "/usr/include/json")
|
||||
if(NOT EXISTS ${JSON_INCLUDE_DIR})
|
||||
message(FATAL_ERROR "json-devel not found. Please install: yum install -y json-devel")
|
||||
endif()
|
||||
set(JSON_TARGET "")
|
||||
# CentOS 使用系统安装的 nlohmann_json
|
||||
find_package(nlohmann_json REQUIRED)
|
||||
endif()
|
||||
set(JSON_TARGET nlohmann_json::nlohmann_json)
|
||||
|
||||
# 源文件列表
|
||||
set(LIB_SOURCES
|
||||
@ -78,7 +74,6 @@ target_include_directories(${PROJECT_NAME}_lib
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
${Boost_INCLUDE_DIRS}
|
||||
${CURL_INCLUDE_DIRS}
|
||||
$<$<NOT:$<PLATFORM_ID:Darwin>>:${JSON_INCLUDE_DIR}> # 仅在非 macOS 系统添加
|
||||
)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME}_lib
|
||||
|
||||
Loading…
Reference in New Issue
Block a user