@@ -753,7 +753,7 @@ else()
753753 ARROW_PROTOBUF_STRIPPED_BUILD_VERSION)
754754 # strip the leading `v`
755755 set_urls (PROTOBUF_SOURCE_URL
756- "https://github.com/protocolbuffers/protobuf/releases/download/${ARROW_PROTOBUF_BUILD_VERSION} /protobuf-all- ${ARROW_PROTOBUF_STRIPPED_BUILD_VERSION} .tar.gz"
756+ "https://github.com/protocolbuffers/protobuf/releases/download/${ARROW_PROTOBUF_BUILD_VERSION} /protobuf-${ARROW_PROTOBUF_STRIPPED_BUILD_VERSION} .tar.gz"
757757 "${THIRDPARTY_MIRROR_URL} /protobuf-${ARROW_PROTOBUF_BUILD_VERSION} .tar.gz" )
758758endif ()
759759
@@ -1864,12 +1864,63 @@ if(ARROW_WITH_THRIFT)
18641864 list (GET Thrift_VERSION_LIST 2 Thrift_VERSION_PATCH)
18651865endif ()
18661866
1867+ # ----------------------------------------------------------------------
1868+ # Abseil defined here so it can be called from build_protobuf()
1869+
1870+ function (build_absl )
1871+ list (APPEND CMAKE_MESSAGE_INDENT "ABSL: " )
1872+ message (STATUS "Building Abseil from source using FetchContent" )
1873+ set (ABSL_VENDORED
1874+ TRUE
1875+ PARENT_SCOPE )
1876+
1877+ if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.0)
1878+ string (APPEND CMAKE_CXX_FLAGS " -include stdint.h" )
1879+ endif ()
1880+
1881+ fetchcontent_declare (absl
1882+ ${FC_DECLARE_COMMON_OPTIONS} OVERRIDE_FIND_PACKAGE
1883+ URL ${ABSL_SOURCE_URL}
1884+ URL_HASH "SHA256=${ARROW_ABSL_BUILD_SHA256_CHECKSUM} " )
1885+
1886+ prepare_fetchcontent ()
1887+
1888+ # We have to enable Abseil install to add Abseil targets to an export set.
1889+ # But we don't install Abseil by EXCLUDE_FROM_ALL.
1890+ set (ABSL_ENABLE_INSTALL ON )
1891+ fetchcontent_makeavailable (absl)
1892+
1893+ if (CMAKE_VERSION VERSION_LESS 3.28)
1894+ set_property (DIRECTORY ${absl_SOURCE_DIR } PROPERTY EXCLUDE_FROM_ALL TRUE )
1895+ endif ()
1896+
1897+ if (APPLE )
1898+ # This is due to upstream absl::cctz issue
1899+ # https://github.com/abseil/abseil-cpp/issues/283
1900+ find_library (CoreFoundation CoreFoundation )
1901+ # When ABSL_ENABLE_INSTALL is ON, the real target is "time" not "absl_time"
1902+ # Cannot use set_property on alias targets (absl::time is an alias)
1903+ set_property (TARGET time
1904+ APPEND
1905+ PROPERTY INTERFACE_LINK_LIBRARIES ${CoreFoundation} )
1906+ endif ()
1907+ list (POP_BACK CMAKE_MESSAGE_INDENT)
1908+ endfunction ()
1909+
18671910# ----------------------------------------------------------------------
18681911# Protocol Buffers (required for ORC, Flight and Substrait libraries)
18691912
18701913function (build_protobuf )
18711914 list (APPEND CMAKE_MESSAGE_INDENT "Protobuf: " )
18721915 message (STATUS "Building Protocol Buffers from source using FetchContent" )
1916+
1917+ # Protobuf requires Abseil. Build Abseil first with OVERRIDE_FIND_PACKAGE
1918+ # so that protobuf doesn't build its own copy and we can reuse it on google-cloud-cpp
1919+ # if it's also being built.
1920+ if (NOT TARGET absl::strings)
1921+ build_absl ()
1922+ endif ()
1923+
18731924 set (PROTOBUF_VENDORED
18741925 TRUE
18751926 PARENT_SCOPE )
@@ -1885,8 +1936,7 @@ function(build_protobuf)
18851936 fetchcontent_declare (protobuf
18861937 ${FC_DECLARE_COMMON_OPTIONS} OVERRIDE_FIND_PACKAGE
18871938 URL ${PROTOBUF_SOURCE_URL}
1888- URL_HASH "SHA256=${ARROW_PROTOBUF_BUILD_SHA256_CHECKSUM} "
1889- SOURCE_SUBDIR cmake)
1939+ URL_HASH "SHA256=${ARROW_PROTOBUF_BUILD_SHA256_CHECKSUM} " )
18901940
18911941 prepare_fetchcontent ()
18921942
@@ -3030,46 +3080,6 @@ endfunction()
30303080# ----------------------------------------------------------------------
30313081# Dependencies for Arrow Flight RPC
30323082
3033- function (build_absl )
3034- list (APPEND CMAKE_MESSAGE_INDENT "ABSL: " )
3035- message (STATUS "Building Abseil from source using FetchContent" )
3036- set (ABSL_VENDORED
3037- TRUE
3038- PARENT_SCOPE )
3039-
3040- if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.0)
3041- string (APPEND CMAKE_CXX_FLAGS " -include stdint.h" )
3042- endif ()
3043-
3044- fetchcontent_declare (absl
3045- ${FC_DECLARE_COMMON_OPTIONS} OVERRIDE_FIND_PACKAGE
3046- URL ${ABSL_SOURCE_URL}
3047- URL_HASH "SHA256=${ARROW_ABSL_BUILD_SHA256_CHECKSUM} " )
3048-
3049- prepare_fetchcontent ()
3050-
3051- # We have to enable Abseil install to add Abseil targets to an export set.
3052- # But we don't install Abseil by EXCLUDE_FROM_ALL.
3053- set (ABSL_ENABLE_INSTALL ON )
3054- fetchcontent_makeavailable (absl)
3055-
3056- if (CMAKE_VERSION VERSION_LESS 3.28)
3057- set_property (DIRECTORY ${absl_SOURCE_DIR } PROPERTY EXCLUDE_FROM_ALL TRUE )
3058- endif ()
3059-
3060- if (APPLE )
3061- # This is due to upstream absl::cctz issue
3062- # https://github.com/abseil/abseil-cpp/issues/283
3063- find_library (CoreFoundation CoreFoundation )
3064- # When ABSL_ENABLE_INSTALL is ON, the real target is "time" not "absl_time"
3065- # Cannot use set_property on alias targets (absl::time is an alias)
3066- set_property (TARGET time
3067- APPEND
3068- PROPERTY INTERFACE_LINK_LIBRARIES ${CoreFoundation} )
3069- endif ()
3070- list (POP_BACK CMAKE_MESSAGE_INDENT)
3071- endfunction ()
3072-
30733083function (build_grpc )
30743084 resolve_dependency (c-ares
30753085 ARROW_CMAKE_PACKAGE_NAME
@@ -3145,8 +3155,7 @@ function(build_grpc)
31453155 gpr
31463156 grpc
31473157 grpc++
3148- grpc++_reflection
3149- upb)
3158+ grpc++_reflection)
31503159
31513160 foreach (target ${GRPC_LIBRARY_TARGETS} )
31523161 if (TARGET ${target} AND NOT TARGET gRPC::${target} )
@@ -3194,8 +3203,7 @@ function(build_grpc)
31943203 gRPC::address_sorting
31953204 gRPC::gpr
31963205 gRPC::grpc
3197- gRPC::grpcpp_for_bundling
3198- gRPC::upb)
3206+ gRPC::grpcpp_for_bundling)
31993207 set (ARROW_BUNDLED_STATIC_LIBS
32003208 "${ARROW_BUNDLED_STATIC_LIBS} "
32013209 PARENT_SCOPE )
0 commit comments