Skip to content

Commit a9fde56

Browse files
hillwoodrocdeepin-bot[bot]
authored andcommitted
fix: Don't link boost_system for Boost 1.89+
Since version 1.89, the Boost.System library has become header-only and no longer requires linking.
1 parent 74f37da commit a9fde56

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

misc/dfm-search/dfm-searchConfig.cmake.in

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@ include(CMakeFindDependencyMacro)
44
find_dependency(Qt@QT_VERSION_MAJOR@ COMPONENTS Core)
55
find_dependency(Dtk@DFM_VERSION_MAJOR@ COMPONENTS Core)
66
find_dependency(Threads)
7-
find_dependency(Boost COMPONENTS system)
7+
find_package(Boost REQUIRED)
8+
9+
if (Boost_VERSION_STRING VERSION_LESS "1.89.0")
10+
message(STATUS "Boost < 1.89 → using Boost::system")
11+
find_package(Boost REQUIRED COMPONENTS system)
12+
endif()
813

914
# 查找 PkgConfig 和 liblucene++ 依赖
1015
find_dependency(PkgConfig)

src/dfm-search/dfm-search-lib/dfm-search.cmake

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core REQUIRED)
33
find_package(Dtk${DFM_VERSION_MAJOR} COMPONENTS Core REQUIRED)
44
find_package(Threads REQUIRED)
5-
find_package(Boost REQUIRED COMPONENTS system)
5+
find_package(Boost REQUIRED)
6+
7+
if (Boost_VERSION_STRING VERSION_LESS "1.89.0")
8+
message(STATUS "Boost < 1.89 → using Boost::system")
9+
find_package(Boost REQUIRED COMPONENTS system)
10+
endif()
611

712
find_package(PkgConfig REQUIRED)
813
pkg_check_modules(Lucene REQUIRED IMPORTED_TARGET liblucene++ liblucene++-contrib)
@@ -18,9 +23,12 @@ target_link_libraries(${BIN_NAME} PUBLIC
1823
Dtk${DFM_VERSION_MAJOR}::Core
1924
PkgConfig::Lucene
2025
Threads::Threads
21-
Boost::system
2226
)
2327

28+
if (Boost_VERSION_STRING VERSION_LESS "1.89.0")
29+
target_link_libraries(${BIN_NAME} PUBLIC Boost::system)
30+
endif()
31+
2432
target_include_directories(
2533
${BIN_NAME}
2634
PUBLIC

0 commit comments

Comments
 (0)