Skip to content

Commit 17244c0

Browse files
authored
Merge pull request ceph#65970 from cbodley/wip-cmake-arrow-thrift-boost-jammy
cmake: BuildArrow.cmake uses bundled thrift if system version < 0.17 Reviewed-by: Kefu Chai <[email protected]>
2 parents 85b1eb9 + 9d92dbb commit 17244c0

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

cmake/modules/BuildArrow.cmake

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,13 @@ function(build_arrow)
1616
list(APPEND arrow_CMAKE_ARGS -DARROW_JEMALLOC=OFF)
1717

1818
# transitive dependencies
19-
list(APPEND arrow_INTERFACE_LINK_LIBRARIES thrift)
19+
if (thrift_VERSION VERSION_GREATER_EQUAL 0.17)
20+
# build arrow with system thrift, and include the transitive dependency on the Arrow::Arrow target
21+
list(APPEND arrow_INTERFACE_LINK_LIBRARIES thrift)
22+
else()
23+
# build arrow with bundled thrift to work around missing boost dependency
24+
list(APPEND arrow_CMAKE_ARGS -DThrift_SOURCE=BUNDLED -DARROW_THRIFT_USE_SHARED=OFF)
25+
endif()
2026

2127
if (NOT WITH_SYSTEM_UTF8PROC)
2228
# forward utf8proc_ROOT from build_utf8proc()

cmake/modules/Findthrift.cmake

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,19 @@ find_library(
1717
HINTS ${thrift_HOME} ENV thrift_HOME /usr/local /opt/local
1818
PATH_SUFFIXES lib lib64)
1919

20+
if(thrift_INCLUDE_DIR)
21+
file(READ "${thrift_INCLUDE_DIR}/thrift/config.h" THRIFT_CONFIG_H_CONTENT)
22+
string(REGEX MATCH "#define PACKAGE_VERSION \"[0-9.]+\"" THRIFT_VERSION_DEFINITION
23+
"${THRIFT_CONFIG_H_CONTENT}")
24+
string(REGEX MATCH "[0-9.]+" thrift_VERSION "${THRIFT_VERSION_DEFINITION}")
25+
set(thrift_VERSION "${thrift_VERSION}" PARENT_SCOPE)
26+
endif()
27+
2028
include(FindPackageHandleStandardArgs)
21-
find_package_handle_standard_args(thrift DEFAULT_MSG thrift_LIBRARIES
22-
thrift_INCLUDE_DIR)
29+
find_package_handle_standard_args(
30+
thrift
31+
REQUIRED_VARS thrift_LIBRARIES thrift_INCLUDE_DIR
32+
VERSION_VAR thrift_VERSION)
2333
mark_as_advanced(thrift_LIBRARIES thrift_INCLUDE_DIR)
2434

2535
if(thrift_FOUND AND NOT (TARGET thrift::libthrift))

0 commit comments

Comments
 (0)