From b109fc8c495b01391ffcb73d7d215c5ea925f598 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Wed, 3 Dec 2025 12:52:02 +0100 Subject: [PATCH 01/16] GH-48315: [C++] Use FetchContent for bundled Crc32c --- cpp/cmake_modules/ThirdpartyToolchain.cmake | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index c7c744e676fa..46f58f9556e9 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -3594,11 +3594,7 @@ macro(build_google_cloud_cpp_storage) add_dependencies(google_cloud_cpp_dependencies zlib_ep) endif() add_dependencies(google_cloud_cpp_dependencies crc32c_fc) - if(NLOHMANN_JSON_VENDORED) - add_dependencies(google_cloud_cpp_dependencies nlohmann_json_fc) - else() - add_dependencies(google_cloud_cpp_dependencies nlohmann_json::nlohmann_json) - endif() + add_dependencies(google_cloud_cpp_dependencies nlohmann_json::nlohmann_json) set(GOOGLE_CLOUD_CPP_STATIC_LIBRARY_STORAGE "${GOOGLE_CLOUD_CPP_INSTALL_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}google_cloud_cpp_storage${CMAKE_STATIC_LIBRARY_SUFFIX}" From 50d1fed64df04137375ba1a4b08522ccef8f8814 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Thu, 4 Dec 2025 13:52:22 +0100 Subject: [PATCH 02/16] GH-48317: [C++] Use FetchContent for bundled google-cloud-cpp --- cpp/cmake_modules/ThirdpartyToolchain.cmake | 377 ++------------------ cpp/src/arrow/CMakeLists.txt | 7 + cpp/src/arrow/filesystem/CMakeLists.txt | 6 + 3 files changed, 46 insertions(+), 344 deletions(-) diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index 46f58f9556e9..785a9724d407 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -3033,139 +3033,22 @@ function(build_absl) set(ABSL_VENDORED TRUE PARENT_SCOPE) - set(ABSL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/absl_fc-install") - set(ABSL_PREFIX - "${ABSL_PREFIX}" - PARENT_SCOPE) if(CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.0) string(APPEND CMAKE_CXX_FLAGS " -include stdint.h") endif() fetchcontent_declare(absl + ${FC_DECLARE_COMMON_OPTIONS} OVERRIDE_FIND_PACKAGE URL ${ABSL_SOURCE_URL} URL_HASH "SHA256=${ARROW_ABSL_BUILD_SHA256_CHECKSUM}") prepare_fetchcontent() - # We have to enable Abseil install to generate abslConfig.cmake - # so google-cloud-cpp can find Abseil through ExternalProject_Add. Our expectation - # is that this will not be necessary once google-cloud-cpp supports FetchContent. + # Enable Abseil install for CMake config generation set(ABSL_ENABLE_INSTALL ON) fetchcontent_makeavailable(absl) - # This custom target is required due to a timing issue between FetchContent - # and the install command below, which is necessary for google-cloud-cpp to find Abseil - # due to mixing FetchContent and ExternalProject_Add. - # Create a target that depends on ALL Abseil libraries that will be installed. - # This ensures they're all built before we try to install. - add_custom_target(absl_built - DEPENDS absl::bad_any_cast_impl - absl::bad_optional_access - absl::bad_variant_access - absl::base - absl::city - absl::civil_time - absl::cord - absl::cord_internal - absl::cordz_functions - absl::cordz_handle - absl::cordz_info - absl::cordz_sample_token - absl::debugging_internal - absl::demangle_internal - absl::examine_stack - absl::exponential_biased - absl::failure_signal_handler - absl::flags - absl::flags_commandlineflag - absl::flags_commandlineflag_internal - absl::flags_config - absl::flags_internal - absl::flags_marshalling - absl::flags_parse - absl::flags_private_handle_accessor - absl::flags_program_name - absl::flags_reflection - absl::flags_usage - absl::flags_usage_internal - absl::graphcycles_internal - absl::hash - absl::hashtablez_sampler - absl::int128 - absl::leak_check - absl::leak_check_disable - absl::log_severity - absl::low_level_hash - absl::malloc_internal - absl::periodic_sampler - absl::random_distributions - absl::random_internal_distribution_test_util - absl::random_internal_platform - absl::random_internal_pool_urbg - absl::random_internal_randen - absl::random_internal_randen_hwaes - absl::random_internal_randen_hwaes_impl - absl::random_internal_randen_slow - absl::random_internal_seed_material - absl::random_seed_gen_exception - absl::random_seed_sequences - absl::raw_hash_set - absl::raw_logging_internal - absl::scoped_set_env - absl::spinlock_wait - absl::stacktrace - absl::status - absl::statusor - absl::str_format_internal - absl::strerror - absl::strings - absl::strings_internal - absl::symbolize - absl::synchronization - absl::throw_delegate - absl::time - absl::time_zone) - - # google-cloud-cpp requires Abseil to be installed to a known location. - # We have to do this in two steps to avoid double installation of Abseil - # when Arrow is installed. - # Disable Abseil's install script this target runs after Abseil is built - # and replaces its cmake_install.cmake with a no-op so Arrow does not install it - # outside of the build tree. - add_custom_command(OUTPUT "${absl_BINARY_DIR}/cmake_install.cmake.saved" - COMMAND ${CMAKE_COMMAND} -E copy_if_different - "${absl_BINARY_DIR}/cmake_install.cmake" - "${absl_BINARY_DIR}/cmake_install.cmake.saved" - COMMAND ${CMAKE_COMMAND} -E echo - "# Abseil install disabled to prevent double installation with Arrow" - > "${absl_BINARY_DIR}/cmake_install.cmake" - DEPENDS absl_built - COMMENT "Disabling Abseil's install to prevent double installation" - VERBATIM) - - add_custom_target(absl_install_disabled ALL - DEPENDS "${absl_BINARY_DIR}/cmake_install.cmake.saved") - - # Install Abseil to ABSL_PREFIX for google-cloud-cpp to find. - # Using the saved original cmake_install.cmake.saved install script - # for other dependencies to find Abseil. - add_custom_command(OUTPUT "${ABSL_PREFIX}/.absl_installed" - COMMAND ${CMAKE_COMMAND} -E copy_if_different - "${absl_BINARY_DIR}/cmake_install.cmake.saved" - "${absl_BINARY_DIR}/cmake_install.cmake.tmp" - COMMAND ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${ABSL_PREFIX} - -DCMAKE_INSTALL_CONFIG_NAME=$ -P - "${absl_BINARY_DIR}/cmake_install.cmake.tmp" || - ${CMAKE_COMMAND} -E true - COMMAND ${CMAKE_COMMAND} -E touch "${ABSL_PREFIX}/.absl_installed" - DEPENDS absl_install_disabled - COMMENT "Installing Abseil to ${ABSL_PREFIX} for gRPC" - VERBATIM) - - # Make absl_fc depend on the install completion marker - add_custom_target(absl_fc DEPENDS "${ABSL_PREFIX}/.absl_installed") - if(APPLE) # This is due to upstream absl::cctz issue # https://github.com/abseil/abseil-cpp/issues/283 @@ -3403,7 +3286,7 @@ function(build_crc32c_once) PARENT_SCOPE) fetchcontent_declare(crc32c - ${FC_DECLARE_COMMON_OPTIONS} + ${FC_DECLARE_COMMON_OPTIONS} OVERRIDE_FIND_PACKAGE URL ${CRC32C_SOURCE_URL} URL_HASH "SHA256=${ARROW_CRC32C_BUILD_SHA256_CHECKSUM}") @@ -3412,7 +3295,6 @@ function(build_crc32c_once) set(CRC32C_BUILD_TESTS OFF) set(CRC32C_BUILD_BENCHMARKS OFF) set(CRC32C_USE_GLOG OFF) - set(CRC32C_INSTALL ON) fetchcontent_makeavailable(crc32c) # Create alias target for consistency (crc32c exports as Crc32c::crc32c when installed) @@ -3420,45 +3302,6 @@ function(build_crc32c_once) add_library(Crc32c::crc32c ALIAS crc32c) endif() - # google-cloud-cpp requires crc32c to be installed to a known location. - # We have to do this in two steps to avoid double installation of crc32c - # when Arrow is installed. - # This custom target ensures crc32c is built before we install. - add_custom_target(crc32c_built DEPENDS Crc32c::crc32c) - - # Disable crc32c's install script after it's built to prevent double installation. - add_custom_command(OUTPUT "${crc32c_BINARY_DIR}/cmake_install.cmake.saved" - COMMAND ${CMAKE_COMMAND} -E copy_if_different - "${crc32c_BINARY_DIR}/cmake_install.cmake" - "${crc32c_BINARY_DIR}/cmake_install.cmake.saved" - COMMAND ${CMAKE_COMMAND} -E echo - "# crc32c install disabled to prevent double installation with Arrow" - > "${crc32c_BINARY_DIR}/cmake_install.cmake" - DEPENDS crc32c_built - COMMENT "Disabling crc32c install to prevent double installation" - VERBATIM) - - add_custom_target(crc32c_install_disabled ALL - DEPENDS "${crc32c_BINARY_DIR}/cmake_install.cmake.saved") - - # Install crc32c to CRC32C_PREFIX for google-cloud-cpp to find. - add_custom_command(OUTPUT "${CRC32C_PREFIX}/.crc32c_installed" - COMMAND ${CMAKE_COMMAND} -E copy_if_different - "${crc32c_BINARY_DIR}/cmake_install.cmake.saved" - "${crc32c_BINARY_DIR}/cmake_install.cmake.tmp" - COMMAND ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${CRC32C_PREFIX} - -DCMAKE_INSTALL_CONFIG_NAME=$ -P - "${crc32c_BINARY_DIR}/cmake_install.cmake.tmp" || - ${CMAKE_COMMAND} -E true - COMMAND ${CMAKE_COMMAND} -E touch - "${CRC32C_PREFIX}/.crc32c_installed" - DEPENDS crc32c_install_disabled - COMMENT "Installing crc32c to ${CRC32C_PREFIX} for google-cloud-cpp" - VERBATIM) - - # Make crc32c_fc depend on the install completion marker. - add_custom_target(crc32c_fc DEPENDS "${CRC32C_PREFIX}/.crc32c_installed") - set(ARROW_BUNDLED_STATIC_LIBS ${ARROW_BUNDLED_STATIC_LIBS} Crc32c::crc32c PARENT_SCOPE) @@ -3477,7 +3320,7 @@ function(build_nlohmann_json) PARENT_SCOPE) fetchcontent_declare(nlohmann_json - ${FC_DECLARE_COMMON_OPTIONS} + ${FC_DECLARE_COMMON_OPTIONS} OVERRIDE_FIND_PACKAGE URL ${NLOHMANN_JSON_SOURCE_URL} URL_HASH "SHA256=${ARROW_NLOHMANN_JSON_BUILD_SHA256_CHECKSUM}") @@ -3489,7 +3332,7 @@ function(build_nlohmann_json) set(JSON_Install ON) fetchcontent_makeavailable(nlohmann_json) - # google-cloud-cpp requires nlohmann_json to be installed to a known location. + # opentelemetry requires nlohmann_json to be installed to a known location. # We have to do this in two steps to avoid double installation of nlohmann_json # when Arrow is installed. # This custom target ensures nlohmann_json is built before we install. @@ -3510,7 +3353,7 @@ function(build_nlohmann_json) add_custom_target(nlohmann_json_install_disabled ALL DEPENDS "${nlohmann_json_BINARY_DIR}/cmake_install.cmake.saved") - # Install nlohmann_json to NLOHMANN_JSON_PREFIX for google-cloud-cpp to find. + # Install nlohmann_json to NLOHMANN_JSON_PREFIX for opentelemetry to find. add_custom_command(OUTPUT "${NLOHMANN_JSON_PREFIX}/.nlohmann_json_installed" COMMAND ${CMAKE_COMMAND} -E copy_if_different "${nlohmann_json_BINARY_DIR}/cmake_install.cmake.saved" @@ -3539,9 +3382,12 @@ if(ARROW_WITH_NLOHMANN_JSON) message(STATUS "Found nlohmann_json headers: ${nlohmann_json_INCLUDE_DIR}") endif() -macro(build_google_cloud_cpp_storage) - message(STATUS "Building google-cloud-cpp from source") - message(STATUS "Only building the google-cloud-cpp::storage component") +function(build_google_cloud_cpp_storage) + list(APPEND CMAKE_MESSAGE_INDENT "google-cloud-cpp: ") + message(STATUS "Building google-cloud-cpp from source using FetchContent") + set(GOOGLE_CLOUD_CPP_VENDORED + TRUE + PARENT_SCOPE) # List of dependencies taken from https://github.com/googleapis/google-cloud-cpp/blob/main/doc/packaging.md build_crc32c_once() @@ -3550,192 +3396,35 @@ macro(build_google_cloud_cpp_storage) # For now, force its inclusion from the underlying system or fail. find_curl() - # Build google-cloud-cpp, with only storage_client + fetchcontent_declare(google_cloud_cpp + URL ${google_cloud_cpp_storage_SOURCE_URL} + URL_HASH "SHA256=${ARROW_GOOGLE_CLOUD_CPP_BUILD_SHA256_CHECKSUM}") - # Inject vendored packages via CMAKE_PREFIX_PATH - if(ABSL_VENDORED) - list(APPEND GOOGLE_CLOUD_CPP_PREFIX_PATH_LIST ${ABSL_PREFIX}) - endif() - if(ZLIB_VENDORED) - list(APPEND GOOGLE_CLOUD_CPP_PREFIX_PATH_LIST ${ZLIB_PREFIX}) - endif() - list(APPEND GOOGLE_CLOUD_CPP_PREFIX_PATH_LIST ${CRC32C_PREFIX}) - list(APPEND GOOGLE_CLOUD_CPP_PREFIX_PATH_LIST ${NLOHMANN_JSON_PREFIX}) - - string(JOIN ${EP_LIST_SEPARATOR} GOOGLE_CLOUD_CPP_PREFIX_PATH - ${GOOGLE_CLOUD_CPP_PREFIX_PATH_LIST}) - - set(GOOGLE_CLOUD_CPP_INSTALL_PREFIX - "${CMAKE_CURRENT_BINARY_DIR}/google_cloud_cpp_ep-install") - set(GOOGLE_CLOUD_CPP_INCLUDE_DIR "${GOOGLE_CLOUD_CPP_INSTALL_PREFIX}/include") - set(GOOGLE_CLOUD_CPP_CMAKE_ARGS - ${EP_COMMON_CMAKE_ARGS} - "-DCMAKE_INSTALL_PREFIX=" - -DCMAKE_INSTALL_RPATH=$ORIGIN - -DCMAKE_PREFIX_PATH=${GOOGLE_CLOUD_CPP_PREFIX_PATH} - # Compile only the storage library and its dependencies. To enable - # other services (Spanner, Bigtable, etc.) add them (as a list) to this - # parameter. Each has its own `google-cloud-cpp::*` library. - -DGOOGLE_CLOUD_CPP_ENABLE=storage - # We need this to build with OpenSSL 3.0. - # See also: https://github.com/googleapis/google-cloud-cpp/issues/8544 - -DGOOGLE_CLOUD_CPP_ENABLE_WERROR=OFF - -DGOOGLE_CLOUD_CPP_WITH_MOCKS=OFF - -DOPENSSL_CRYPTO_LIBRARY=${OPENSSL_CRYPTO_LIBRARY} - -DOPENSSL_INCLUDE_DIR=${OPENSSL_INCLUDE_DIR} - -DOPENSSL_SSL_LIBRARY=${OPENSSL_SSL_LIBRARY}) - - add_custom_target(google_cloud_cpp_dependencies) - - if(ABSL_VENDORED) - add_dependencies(google_cloud_cpp_dependencies absl_fc) - endif() - if(ZLIB_VENDORED) - add_dependencies(google_cloud_cpp_dependencies zlib_ep) - endif() - add_dependencies(google_cloud_cpp_dependencies crc32c_fc) - add_dependencies(google_cloud_cpp_dependencies nlohmann_json::nlohmann_json) - - set(GOOGLE_CLOUD_CPP_STATIC_LIBRARY_STORAGE - "${GOOGLE_CLOUD_CPP_INSTALL_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}google_cloud_cpp_storage${CMAKE_STATIC_LIBRARY_SUFFIX}" - ) + prepare_fetchcontent() - set(GOOGLE_CLOUD_CPP_STATIC_LIBRARY_REST_INTERNAL - "${GOOGLE_CLOUD_CPP_INSTALL_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}google_cloud_cpp_rest_internal${CMAKE_STATIC_LIBRARY_SUFFIX}" - ) + message(STATUS "Only building the google-cloud-cpp::storage component") + set(GOOGLE_CLOUD_CPP_ENABLE storage) + # We need this to build with OpenSSL 3.0. + # See also: https://github.com/googleapis/google-cloud-cpp/issues/8544 + set(GOOGLE_CLOUD_CPP_ENABLE_WERROR OFF) + set(GOOGLE_CLOUD_CPP_WITH_MOCKS OFF) + set(BUILD_TESTING OFF) + # Unity build causes some build errors. + set(CMAKE_UNITY_BUILD FALSE) - set(GOOGLE_CLOUD_CPP_STATIC_LIBRARY_COMMON - "${GOOGLE_CLOUD_CPP_INSTALL_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}google_cloud_cpp_common${CMAKE_STATIC_LIBRARY_SUFFIX}" - ) + fetchcontent_makeavailable(google_cloud_cpp) # Remove unused directories to save build directory storage. # 141MB -> 79MB - set(GOOGLE_CLOUD_CPP_PATCH_COMMAND ${CMAKE_COMMAND} -E) - if(CMAKE_VERSION VERSION_LESS 3.17) - list(APPEND GOOGLE_CLOUD_CPP_PATCH_COMMAND remove_directory) - else() - list(APPEND GOOGLE_CLOUD_CPP_PATCH_COMMAND rm -rf) - endif() - list(APPEND GOOGLE_CLOUD_CPP_PATCH_COMMAND ci) - - externalproject_add(google_cloud_cpp_ep - ${EP_COMMON_OPTIONS} - INSTALL_DIR ${GOOGLE_CLOUD_CPP_INSTALL_PREFIX} - URL ${google_cloud_cpp_storage_SOURCE_URL} - URL_HASH "SHA256=${ARROW_GOOGLE_CLOUD_CPP_BUILD_SHA256_CHECKSUM}" - PATCH_COMMAND ${GOOGLE_CLOUD_CPP_PATCH_COMMAND} - CMAKE_ARGS ${GOOGLE_CLOUD_CPP_CMAKE_ARGS} - BUILD_BYPRODUCTS ${GOOGLE_CLOUD_CPP_STATIC_LIBRARY_STORAGE} - ${GOOGLE_CLOUD_CPP_STATIC_LIBRARY_REST_INTERNAL} - ${GOOGLE_CLOUD_CPP_STATIC_LIBRARY_COMMON} - DEPENDS google_cloud_cpp_dependencies) - - # Work around https://gitlab.kitware.com/cmake/cmake/issues/15052 - file(MAKE_DIRECTORY ${GOOGLE_CLOUD_CPP_INCLUDE_DIR}) + file(REMOVE_RECURSE "${google_cloud_cpp_SOURCE_DIR}/ci") - add_library(google-cloud-cpp::common STATIC IMPORTED) - set_target_properties(google-cloud-cpp::common - PROPERTIES IMPORTED_LOCATION - "${GOOGLE_CLOUD_CPP_STATIC_LIBRARY_COMMON}") - target_include_directories(google-cloud-cpp::common BEFORE - INTERFACE "${GOOGLE_CLOUD_CPP_INCLUDE_DIR}") - # Refer to https://github.com/googleapis/google-cloud-cpp/blob/main/google/cloud/google_cloud_cpp_common.cmake - # (substitute `main` for the SHA of the version we use) - # Version 1.39.0 is at a different place (they refactored after): - # https://github.com/googleapis/google-cloud-cpp/blob/29e5af8ca9b26cec62106d189b50549f4dc1c598/google/cloud/CMakeLists.txt#L146-L155 - target_link_libraries(google-cloud-cpp::common - INTERFACE absl::base - absl::cord - absl::memory - absl::optional - absl::span - absl::time - absl::variant - Threads::Threads - OpenSSL::Crypto) - - add_library(google-cloud-cpp::rest-internal STATIC IMPORTED) - set_target_properties(google-cloud-cpp::rest-internal - PROPERTIES IMPORTED_LOCATION - "${GOOGLE_CLOUD_CPP_STATIC_LIBRARY_REST_INTERNAL}") - target_include_directories(google-cloud-cpp::rest-internal BEFORE - INTERFACE "${GOOGLE_CLOUD_CPP_INCLUDE_DIR}") - target_link_libraries(google-cloud-cpp::rest-internal - INTERFACE absl::span - google-cloud-cpp::common - CURL::libcurl - nlohmann_json::nlohmann_json - OpenSSL::SSL - OpenSSL::Crypto) - if(WIN32) - target_link_libraries(google-cloud-cpp::rest-internal INTERFACE ws2_32) - endif() - - add_library(google-cloud-cpp::storage STATIC IMPORTED) - set_target_properties(google-cloud-cpp::storage - PROPERTIES IMPORTED_LOCATION - "${GOOGLE_CLOUD_CPP_STATIC_LIBRARY_STORAGE}") - target_include_directories(google-cloud-cpp::storage BEFORE - INTERFACE "${GOOGLE_CLOUD_CPP_INCLUDE_DIR}") - # Update this from https://github.com/googleapis/google-cloud-cpp/blob/main/google/cloud/storage/google_cloud_cpp_storage.cmake - target_link_libraries(google-cloud-cpp::storage - INTERFACE google-cloud-cpp::common - google-cloud-cpp::rest-internal - absl::memory - absl::strings - absl::str_format - absl::time - absl::variant - nlohmann_json::nlohmann_json - Crc32c::crc32c - CURL::libcurl - Threads::Threads - OpenSSL::SSL - OpenSSL::Crypto - ZLIB::ZLIB) - add_dependencies(google-cloud-cpp::storage google_cloud_cpp_ep) + set(ARROW_BUNDLED_STATIC_LIBS + ${ARROW_BUNDLED_STATIC_LIBS} google-cloud-cpp::storage + google-cloud-cpp::rest_internal google-cloud-cpp::common + PARENT_SCOPE) - list(APPEND - ARROW_BUNDLED_STATIC_LIBS - google-cloud-cpp::storage - google-cloud-cpp::rest-internal - google-cloud-cpp::common) - if(ABSL_VENDORED) - # Figure out what absl libraries (not header-only) are required by the - # google-cloud-cpp libraries above and add them to the bundled_dependencies - # - # pkg-config --libs absl_memory absl_strings absl_str_format absl_time absl_variant absl_base absl_memory absl_optional absl_span absl_time absl_variant - # (and then some regexing) - list(APPEND - ARROW_BUNDLED_STATIC_LIBS - absl::bad_optional_access - absl::bad_variant_access - absl::base - absl::civil_time - absl::cord - absl::cord_internal - absl::cordz_functions - absl::cordz_info - absl::cordz_handle - absl::debugging_internal - absl::demangle_internal - absl::exponential_biased - absl::int128 - absl::log_severity - absl::malloc_internal - absl::raw_logging_internal - absl::spinlock_wait - absl::stacktrace - absl::str_format_internal - absl::strings - absl::strings_internal - absl::symbolize - absl::synchronization - absl::throw_delegate - absl::time - absl::time_zone) - endif() -endmacro() + list(POP_BACK CMAKE_MESSAGE_INDENT) +endfunction() if(ARROW_WITH_GOOGLE_CLOUD_CPP) if(NOT ARROW_ENABLE_THREADING) diff --git a/cpp/src/arrow/CMakeLists.txt b/cpp/src/arrow/CMakeLists.txt index ec8b6c1b32f2..deb6db3cdd37 100644 --- a/cpp/src/arrow/CMakeLists.txt +++ b/cpp/src/arrow/CMakeLists.txt @@ -909,6 +909,13 @@ if(ARROW_FILESYSTEM) list(APPEND ARROW_FILESYSTEM_SRCS filesystem/gcsfs.cc filesystem/gcsfs_internal.cc) set_source_files_properties(filesystem/gcsfs.cc filesystem/gcsfs_internal.cc PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON) + # Suppress documentation warnings from google-cloud-cpp headers + if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|AppleClang") + set_source_files_properties(filesystem/gcsfs.cc filesystem/gcsfs_internal.cc + PROPERTIES COMPILE_FLAGS + "-Wno-documentation -Wno-documentation-deprecated-sync" + ) + endif() endif() if(ARROW_HDFS) list(APPEND ARROW_FILESYSTEM_SRCS filesystem/hdfs.cc) diff --git a/cpp/src/arrow/filesystem/CMakeLists.txt b/cpp/src/arrow/filesystem/CMakeLists.txt index 9c5e655f6cc7..e6330df42603 100644 --- a/cpp/src/arrow/filesystem/CMakeLists.txt +++ b/cpp/src/arrow/filesystem/CMakeLists.txt @@ -48,6 +48,12 @@ if(ARROW_GCS) filesystem EXTRA_LINK_LIBS google-cloud-cpp::storage) + if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|AppleClang") + if(TARGET arrow-gcsfs-test) + target_compile_options(arrow-gcsfs-test PRIVATE -Wno-documentation + -Wno-documentation-deprecated-sync) + endif() + endif() endif() if(ARROW_AZURE) From 8720d2bd80a4cc58093af98d13370ac8a8e1d80c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Fri, 5 Dec 2025 12:46:39 +0100 Subject: [PATCH 03/16] Add absl libraries to ARROW_BUNDLED_STATIC_LIBS if ABSL_VENDORED for google cloud --- cpp/cmake_modules/ThirdpartyToolchain.cmake | 36 +++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index 785a9724d407..36e180227d93 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -3423,6 +3423,42 @@ function(build_google_cloud_cpp_storage) google-cloud-cpp::rest_internal google-cloud-cpp::common PARENT_SCOPE) + if(ABSL_VENDORED) + # Figure out what absl libraries (not header-only) are required by the + # google-cloud-cpp libraries above and add them to the bundled_dependencies + # + # pkg-config --libs absl_memory absl_strings absl_str_format absl_time absl_variant absl_base absl_memory absl_optional absl_span absl_time absl_variant + # (and then some regexing) + list(APPEND + ARROW_BUNDLED_STATIC_LIBS + absl::bad_optional_access + absl::bad_variant_access + absl::base + absl::civil_time + absl::cord + absl::cord_internal + absl::cordz_functions + absl::cordz_info + absl::cordz_handle + absl::debugging_internal + absl::demangle_internal + absl::exponential_biased + absl::int128 + absl::log_severity + absl::malloc_internal + absl::raw_logging_internal + absl::spinlock_wait + absl::stacktrace + absl::str_format_internal + absl::strings + absl::strings_internal + absl::symbolize + absl::synchronization + absl::throw_delegate + absl::time + absl::time_zone) + endif() + list(POP_BACK CMAKE_MESSAGE_INDENT) endfunction() From 34827325c5988a2fbe2141ea945fc045ff90c671 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Fri, 5 Dec 2025 13:15:44 +0100 Subject: [PATCH 04/16] Try different approach of defining ARROW_BUNDLED_STATIC_LIBS with parent scope --- cpp/cmake_modules/ThirdpartyToolchain.cmake | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index 36e180227d93..bca1bf5805cf 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -3417,11 +3417,11 @@ function(build_google_cloud_cpp_storage) # Remove unused directories to save build directory storage. # 141MB -> 79MB file(REMOVE_RECURSE "${google_cloud_cpp_SOURCE_DIR}/ci") - - set(ARROW_BUNDLED_STATIC_LIBS - ${ARROW_BUNDLED_STATIC_LIBS} google-cloud-cpp::storage - google-cloud-cpp::rest_internal google-cloud-cpp::common - PARENT_SCOPE) + list(APPEND + ARROW_BUNDLED_STATIC_LIBS + google-cloud-cpp::storage + google-cloud-cpp::rest_internal + google-cloud-cpp::common) if(ABSL_VENDORED) # Figure out what absl libraries (not header-only) are required by the @@ -3459,6 +3459,10 @@ function(build_google_cloud_cpp_storage) absl::time_zone) endif() + set(ARROW_BUNDLED_STATIC_LIBS + "${ARROW_BUNDLED_STATIC_LIBS}" + PARENT_SCOPE) + list(POP_BACK CMAKE_MESSAGE_INDENT) endfunction() From cd3bf7becadd8fcdff76e98c6de901e2bcc9f0cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Fri, 5 Dec 2025 17:05:15 +0100 Subject: [PATCH 05/16] Set install off for crc32c and abseil and add FC_DECLARE_COMMON_OPTIONS for google-cloud --- cpp/cmake_modules/ThirdpartyToolchain.cmake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index bca1bf5805cf..3e2deb3e7086 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -3045,8 +3045,7 @@ function(build_absl) prepare_fetchcontent() - # Enable Abseil install for CMake config generation - set(ABSL_ENABLE_INSTALL ON) + set(ABSL_ENABLE_INSTALL OFF) fetchcontent_makeavailable(absl) if(APPLE) @@ -3295,6 +3294,7 @@ function(build_crc32c_once) set(CRC32C_BUILD_TESTS OFF) set(CRC32C_BUILD_BENCHMARKS OFF) set(CRC32C_USE_GLOG OFF) + set(CRC32C_INSTALL OFF) fetchcontent_makeavailable(crc32c) # Create alias target for consistency (crc32c exports as Crc32c::crc32c when installed) @@ -3397,6 +3397,7 @@ function(build_google_cloud_cpp_storage) find_curl() fetchcontent_declare(google_cloud_cpp + ${FC_DECLARE_COMMON_OPTIONS} URL ${google_cloud_cpp_storage_SOURCE_URL} URL_HASH "SHA256=${ARROW_GOOGLE_CLOUD_CPP_BUILD_SHA256_CHECKSUM}") From f161d16fa4fe41355a02a5ada492ded4f9f67cd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Fri, 5 Dec 2025 18:43:57 +0100 Subject: [PATCH 06/16] Try something that is probably wrong --- cpp/cmake_modules/ThirdpartyToolchain.cmake | 30 +++- .../google-cloud-cpp-disable-install.patch | 160 ++++++++++++++++++ 2 files changed, 187 insertions(+), 3 deletions(-) create mode 100644 cpp/cmake_modules/google-cloud-cpp-disable-install.patch diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index 3e2deb3e7086..b0d2cadd42d7 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -3052,9 +3052,8 @@ function(build_absl) # This is due to upstream absl::cctz issue # https://github.com/abseil/abseil-cpp/issues/283 find_library(CoreFoundation CoreFoundation) - # When ABSL_ENABLE_INSTALL is ON, the real target is "time" not "absl_time" - # Cannot use set_property on alias targets (absl::time is an alias) - set_property(TARGET time + # The time target (for absl::time) needs CoreFoundation on macOS + set_property(TARGET absl_time APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${CoreFoundation}) endif() @@ -3396,8 +3395,31 @@ function(build_google_cloud_cpp_storage) # For now, force its inclusion from the underlying system or fail. find_curl() + # Apply patch to add GOOGLE_CLOUD_CPP_ENABLE_INSTALL option so it does not install + # unconditionally when embedded via FetchContent. Otherwise, we would have to install + # dependecies like absl, crc32c, nlohmann_json, etc. which is not desirable. + set(GOOGLE_CLOUD_CPP_PATCH_COMMAND) + find_program(PATCH patch) + if(PATCH) + list(APPEND + GOOGLE_CLOUD_CPP_PATCH_COMMAND + ${PATCH} + -p1 + -i) + else() + find_program(GIT git) + if(GIT) + list(APPEND GOOGLE_CLOUD_CPP_PATCH_COMMAND ${GIT} apply) + endif() + endif() + if(GOOGLE_CLOUD_CPP_PATCH_COMMAND) + list(APPEND GOOGLE_CLOUD_CPP_PATCH_COMMAND + ${CMAKE_CURRENT_LIST_DIR}/google-cloud-cpp-disable-install.patch) + endif() + fetchcontent_declare(google_cloud_cpp ${FC_DECLARE_COMMON_OPTIONS} + PATCH_COMMAND ${GOOGLE_CLOUD_CPP_PATCH_COMMAND} URL ${google_cloud_cpp_storage_SOURCE_URL} URL_HASH "SHA256=${ARROW_GOOGLE_CLOUD_CPP_BUILD_SHA256_CHECKSUM}") @@ -3409,6 +3431,8 @@ function(build_google_cloud_cpp_storage) # See also: https://github.com/googleapis/google-cloud-cpp/issues/8544 set(GOOGLE_CLOUD_CPP_ENABLE_WERROR OFF) set(GOOGLE_CLOUD_CPP_WITH_MOCKS OFF) + # Disable installation when embedded via FetchContent + set(GOOGLE_CLOUD_CPP_ENABLE_INSTALL OFF) set(BUILD_TESTING OFF) # Unity build causes some build errors. set(CMAKE_UNITY_BUILD FALSE) diff --git a/cpp/cmake_modules/google-cloud-cpp-disable-install.patch b/cpp/cmake_modules/google-cloud-cpp-disable-install.patch new file mode 100644 index 000000000000..90f24a436092 --- /dev/null +++ b/cpp/cmake_modules/google-cloud-cpp-disable-install.patch @@ -0,0 +1,160 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 3816333816..3e620b20a7 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -52,6 +52,11 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + endif () + endif () + ++option(GOOGLE_CLOUD_CPP_ENABLE_INSTALL ++ "Enable installation of google-cloud-cpp headers and libraries" ++ ON) ++mark_as_advanced(GOOGLE_CLOUD_CPP_ENABLE_INSTALL) ++ + list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) + include(SelectMSVCRuntime) + +diff --git a/cmake/GoogleCloudCppLibrary.cmake b/cmake/GoogleCloudCppLibrary.cmake +index caee116a3a..5cbb03f697 100644 +--- a/cmake/GoogleCloudCppLibrary.cmake ++++ b/cmake/GoogleCloudCppLibrary.cmake +@@ -87,6 +87,7 @@ function (google_cloud_cpp_add_library_protos library) + set(library_target "google_cloud_cpp_${library}") + + # Export the CMake targets to make it easy to create configuration files. ++ if(GOOGLE_CLOUD_CPP_ENABLE_INSTALL) + install( + EXPORT ${library_target}-targets + DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${library_target}" +@@ -104,6 +105,7 @@ function (google_cloud_cpp_add_library_protos library) + NAMELINK_COMPONENT google_cloud_cpp_development + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT google_cloud_cpp_development) ++ endif() + + # Create and install the CMake configuration files. + include(CMakePackageConfigHelpers) +@@ -115,12 +117,14 @@ function (google_cloud_cpp_add_library_protos library) + VERSION ${PROJECT_VERSION} + COMPATIBILITY ExactVersion) + ++ if(GOOGLE_CLOUD_CPP_ENABLE_INSTALL) + install( + FILES + "${CMAKE_CURRENT_BINARY_DIR}/${library_target}-config.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/${library_target}-config-version.cmake" + DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${library_target}" + COMPONENT google_cloud_cpp_development) ++ endif() + endfunction () + + # +@@ -257,6 +261,8 @@ function (google_cloud_cpp_add_gapic_library library display_name) + include(GNUInstallDirs) + + # Export the CMake targets to make it easy to create configuration files. ++ ++ if(GOOGLE_CLOUD_CPP_ENABLE_INSTALL) + install( + EXPORT ${library_target}-targets + DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${library_target}" +@@ -275,6 +281,7 @@ function (google_cloud_cpp_add_gapic_library library display_name) + NAMELINK_COMPONENT google_cloud_cpp_development + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT google_cloud_cpp_development) ++ endif() + + google_cloud_cpp_install_headers("${library_target}" + "include/google/cloud/${library}") +@@ -311,12 +318,14 @@ function (google_cloud_cpp_add_gapic_library library display_name) + VERSION ${PROJECT_VERSION} + COMPATIBILITY ExactVersion) + ++ if(GOOGLE_CLOUD_CPP_ENABLE_INSTALL) + install( + FILES + "${CMAKE_CURRENT_BINARY_DIR}/${library_target}-config.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/${library_target}-config-version.cmake" + DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${library_target}" + COMPONENT google_cloud_cpp_development) ++ endif() + + if (GOOGLE_CLOUD_CPP_WITH_MOCKS) + # Create a header-only library for the mocks. We use a CMake `INTERFACE` +diff --git a/google/cloud/google_cloud_cpp_common.cmake b/google/cloud/google_cloud_cpp_common.cmake +index 5bbc510e18..bd931c17d2 100644 +--- a/google/cloud/google_cloud_cpp_common.cmake ++++ b/google/cloud/google_cloud_cpp_common.cmake +@@ -218,6 +218,7 @@ add_library(google-cloud-cpp::common ALIAS google_cloud_cpp_common) + + create_bazel_config(google_cloud_cpp_common YEAR 2018) + ++if(GOOGLE_CLOUD_CPP_ENABLE_INSTALL) + # Export the CMake targets to make it easy to create configuration files. + install( + EXPORT google_cloud_cpp_common-targets +@@ -238,6 +239,7 @@ install( + COMPONENT google_cloud_cpp_development) + + google_cloud_cpp_install_headers(google_cloud_cpp_common include/google/cloud) ++endif() + + google_cloud_cpp_add_pkgconfig( + "common" +diff --git a/google/cloud/google_cloud_cpp_rest_internal.cmake b/google/cloud/google_cloud_cpp_rest_internal.cmake +index 5da42523bf..3dcd7a9cc9 100644 +--- a/google/cloud/google_cloud_cpp_rest_internal.cmake ++++ b/google/cloud/google_cloud_cpp_rest_internal.cmake +@@ -142,6 +142,7 @@ set_target_properties( + add_library(google-cloud-cpp::rest_internal ALIAS + google_cloud_cpp_rest_internal) + ++if(GOOGLE_CLOUD_CPP_ENABLE_INSTALL) + # Export the CMake targets to make it easy to create configuration files. + install( + EXPORT google_cloud_cpp_rest_internal-targets +@@ -163,6 +164,7 @@ install( + + google_cloud_cpp_install_headers(google_cloud_cpp_rest_internal + include/google/cloud) ++endif() + + google_cloud_cpp_add_pkgconfig( + rest_internal "REST library for the Google Cloud C++ Client Library" +diff --git a/google/cloud/storage/google_cloud_cpp_storage.cmake b/google/cloud/storage/google_cloud_cpp_storage.cmake +index 8e69ad26b6..347250781c 100644 +--- a/google/cloud/storage/google_cloud_cpp_storage.cmake ++++ b/google/cloud/storage/google_cloud_cpp_storage.cmake +@@ -296,6 +296,7 @@ add_library(google-cloud-cpp::storage ALIAS google_cloud_cpp_storage) + + create_bazel_config(google_cloud_cpp_storage) + ++if(GOOGLE_CLOUD_CPP_ENABLE_INSTALL) + # Export the CMake targets to make it easy to create configuration files. + install( + EXPORT storage-targets +@@ -312,6 +313,7 @@ install( + NAMELINK_COMPONENT google_cloud_cpp_development + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT google_cloud_cpp_development) ++endif() + + google_cloud_cpp_install_headers(google_cloud_cpp_storage + include/google/cloud/storage) From ca527d9eae717b8e4a001717d20e302fe30be204 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Tue, 9 Dec 2025 12:55:09 +0100 Subject: [PATCH 07/16] Fix patch to not install header files nor config files --- .../google-cloud-cpp-disable-install.patch | 57 ++++++++++--------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/cpp/cmake_modules/google-cloud-cpp-disable-install.patch b/cpp/cmake_modules/google-cloud-cpp-disable-install.patch index 90f24a436092..129442eef787 100644 --- a/cpp/cmake_modules/google-cloud-cpp-disable-install.patch +++ b/cpp/cmake_modules/google-cloud-cpp-disable-install.patch @@ -32,7 +32,7 @@ index 3816333816..3e620b20a7 100644 include(SelectMSVCRuntime) diff --git a/cmake/GoogleCloudCppLibrary.cmake b/cmake/GoogleCloudCppLibrary.cmake -index caee116a3a..5cbb03f697 100644 +index caee116a3a..fe62e3b4d1 100644 --- a/cmake/GoogleCloudCppLibrary.cmake +++ b/cmake/GoogleCloudCppLibrary.cmake @@ -87,6 +87,7 @@ function (google_cloud_cpp_add_library_protos library) @@ -75,14 +75,14 @@ index caee116a3a..5cbb03f697 100644 install( EXPORT ${library_target}-targets DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${library_target}" -@@ -275,6 +281,7 @@ function (google_cloud_cpp_add_gapic_library library display_name) - NAMELINK_COMPONENT google_cloud_cpp_development - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - COMPONENT google_cloud_cpp_development) -+ endif() +@@ -278,6 +284,7 @@ function (google_cloud_cpp_add_gapic_library library display_name) google_cloud_cpp_install_headers("${library_target}" "include/google/cloud/${library}") ++ endif() + + google_cloud_cpp_add_pkgconfig( + ${library} @@ -311,12 +318,14 @@ function (google_cloud_cpp_add_gapic_library library display_name) VERSION ${PROJECT_VERSION} COMPATIBILITY ExactVersion) @@ -99,7 +99,7 @@ index caee116a3a..5cbb03f697 100644 if (GOOGLE_CLOUD_CPP_WITH_MOCKS) # Create a header-only library for the mocks. We use a CMake `INTERFACE` diff --git a/google/cloud/google_cloud_cpp_common.cmake b/google/cloud/google_cloud_cpp_common.cmake -index 5bbc510e18..bd931c17d2 100644 +index 5bbc510e18..5ced623d9e 100644 --- a/google/cloud/google_cloud_cpp_common.cmake +++ b/google/cloud/google_cloud_cpp_common.cmake @@ -218,6 +218,7 @@ add_library(google-cloud-cpp::common ALIAS google_cloud_cpp_common) @@ -110,16 +110,16 @@ index 5bbc510e18..bd931c17d2 100644 # Export the CMake targets to make it easy to create configuration files. install( EXPORT google_cloud_cpp_common-targets -@@ -238,6 +239,7 @@ install( - COMPONENT google_cloud_cpp_development) - - google_cloud_cpp_install_headers(google_cloud_cpp_common include/google/cloud) +@@ -265,6 +266,7 @@ install( + "${CMAKE_CURRENT_BINARY_DIR}/google_cloud_cpp_common-config-version.cmake" + DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/google_cloud_cpp_common" + COMPONENT google_cloud_cpp_development) +endif() - google_cloud_cpp_add_pkgconfig( - "common" + if (GOOGLE_CLOUD_CPP_WITH_MOCKS) + # Create a header-only library for the mocks. We use a CMake `INTERFACE` diff --git a/google/cloud/google_cloud_cpp_rest_internal.cmake b/google/cloud/google_cloud_cpp_rest_internal.cmake -index 5da42523bf..3dcd7a9cc9 100644 +index 5da42523bf..726b0dceec 100644 --- a/google/cloud/google_cloud_cpp_rest_internal.cmake +++ b/google/cloud/google_cloud_cpp_rest_internal.cmake @@ -142,6 +142,7 @@ set_target_properties( @@ -130,16 +130,16 @@ index 5da42523bf..3dcd7a9cc9 100644 # Export the CMake targets to make it easy to create configuration files. install( EXPORT google_cloud_cpp_rest_internal-targets -@@ -163,6 +164,7 @@ install( - - google_cloud_cpp_install_headers(google_cloud_cpp_rest_internal - include/google/cloud) +@@ -184,6 +185,7 @@ install( + "${CMAKE_CURRENT_BINARY_DIR}/google_cloud_cpp_rest_internal-config-version.cmake" + DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/google_cloud_cpp_rest_internal" + COMPONENT google_cloud_cpp_development) +endif() - google_cloud_cpp_add_pkgconfig( - rest_internal "REST library for the Google Cloud C++ Client Library" + create_bazel_config(google_cloud_cpp_rest_internal YEAR 2021) + diff --git a/google/cloud/storage/google_cloud_cpp_storage.cmake b/google/cloud/storage/google_cloud_cpp_storage.cmake -index 8e69ad26b6..347250781c 100644 +index 8e69ad26b6..272fe3f100 100644 --- a/google/cloud/storage/google_cloud_cpp_storage.cmake +++ b/google/cloud/storage/google_cloud_cpp_storage.cmake @@ -296,6 +296,7 @@ add_library(google-cloud-cpp::storage ALIAS google_cloud_cpp_storage) @@ -150,11 +150,12 @@ index 8e69ad26b6..347250781c 100644 # Export the CMake targets to make it easy to create configuration files. install( EXPORT storage-targets -@@ -312,6 +313,7 @@ install( - NAMELINK_COMPONENT google_cloud_cpp_development - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - COMPONENT google_cloud_cpp_development) +@@ -372,7 +373,7 @@ install( + FILES testing/mock_client.h + DESTINATION include/google/cloud/storage/testing + COMPONENT google_cloud_cpp_development) +- +endif() - - google_cloud_cpp_install_headers(google_cloud_cpp_storage - include/google/cloud/storage) + if (BUILD_TESTING) + add_library( + storage_client_testing # cmake-format: sort From 74f352bed87865007f5fcd2465f5c5cefbafa000 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Tue, 9 Dec 2025 15:30:59 +0100 Subject: [PATCH 08/16] add google_cloud_cpp_storage_grpc to the patch --- .../google-cloud-cpp-disable-install.patch | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/cpp/cmake_modules/google-cloud-cpp-disable-install.patch b/cpp/cmake_modules/google-cloud-cpp-disable-install.patch index 129442eef787..694713988461 100644 --- a/cpp/cmake_modules/google-cloud-cpp-disable-install.patch +++ b/cpp/cmake_modules/google-cloud-cpp-disable-install.patch @@ -159,3 +159,23 @@ index 8e69ad26b6..272fe3f100 100644 if (BUILD_TESTING) add_library( storage_client_testing # cmake-format: sort +diff --git a/google/cloud/storage/google_cloud_cpp_storage_grpc.cmake b/google/cloud/storage/google_cloud_cpp_storage_grpc.cmake +index 680a771a8f..fcea826890 100644 +--- a/google/cloud/storage/google_cloud_cpp_storage_grpc.cmake ++++ b/google/cloud/storage/google_cloud_cpp_storage_grpc.cmake +@@ -192,6 +192,7 @@ endif () + add_library(google-cloud-cpp::experimental-storage_grpc ALIAS + google_cloud_cpp_storage_grpc) + ++ if(GOOGLE_CLOUD_CPP_ENABLE_INSTALL) + google_cloud_cpp_add_pkgconfig( + storage_grpc + "The GCS (Google Cloud Storage) gRPC plugin" +@@ -218,6 +219,7 @@ install( + + google_cloud_cpp_install_headers(google_cloud_cpp_storage_grpc + include/google/cloud/storage) ++endif() + + if (GOOGLE_CLOUD_CPP_WITH_MOCKS) + # Create a header-only library for the mocks. We use a CMake `INTERFACE` From f45fdcc9b9ac2b625e9ff01bcebf32e6f9383788 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Tue, 9 Dec 2025 19:14:01 +0100 Subject: [PATCH 09/16] Try installing patch/git for R bundled --- ci/scripts/r_docker_configure.sh | 3 ++- cpp/cmake_modules/ThirdpartyToolchain.cmake | 17 +++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/ci/scripts/r_docker_configure.sh b/ci/scripts/r_docker_configure.sh index 3039291ebbd8..a1a6d8f21c15 100755 --- a/ci/scripts/r_docker_configure.sh +++ b/ci/scripts/r_docker_configure.sh @@ -73,7 +73,8 @@ fi # Install rsync for bundling cpp source and curl to make sure it is installed on all images, # cmake is now a listed sys req. -$PACKAGE_MANAGER install -y rsync cmake curl +# Install patch/git for applying patches to bundled dependencies via FetchContent. +$PACKAGE_MANAGER install -y rsync cmake curl git patch # Update clang version to latest available. # This is only for rhub/clang20. If we change the base image from rhub/clang20, diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index b0d2cadd42d7..5e3bd9a66546 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -3401,21 +3401,18 @@ function(build_google_cloud_cpp_storage) set(GOOGLE_CLOUD_CPP_PATCH_COMMAND) find_program(PATCH patch) if(PATCH) - list(APPEND - GOOGLE_CLOUD_CPP_PATCH_COMMAND - ${PATCH} - -p1 - -i) + set(GOOGLE_CLOUD_CPP_PATCH_COMMAND + ${PATCH} -p1 -i ${CMAKE_CURRENT_LIST_DIR}/google-cloud-cpp-disable-install.patch) else() find_program(GIT git) if(GIT) - list(APPEND GOOGLE_CLOUD_CPP_PATCH_COMMAND ${GIT} apply) + set(GOOGLE_CLOUD_CPP_PATCH_COMMAND + ${GIT} apply ${CMAKE_CURRENT_LIST_DIR}/google-cloud-cpp-disable-install.patch) + else() + message(FATAL_ERROR "Building google-cloud-cpp from source requires either 'patch' or 'git' to be available" + ) endif() endif() - if(GOOGLE_CLOUD_CPP_PATCH_COMMAND) - list(APPEND GOOGLE_CLOUD_CPP_PATCH_COMMAND - ${CMAKE_CURRENT_LIST_DIR}/google-cloud-cpp-disable-install.patch) - endif() fetchcontent_declare(google_cloud_cpp ${FC_DECLARE_COMMON_OPTIONS} From 8b9512dd2e62fdafb13044acdd3d23d3b4655cf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Wed, 10 Dec 2025 10:15:11 +0100 Subject: [PATCH 10/16] Apply suggestion from review --- cpp/cmake_modules/ThirdpartyToolchain.cmake | 44 ++++++++++++--------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index 5e3bd9a66546..83e3f04cbb45 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -3293,9 +3293,13 @@ function(build_crc32c_once) set(CRC32C_BUILD_TESTS OFF) set(CRC32C_BUILD_BENCHMARKS OFF) set(CRC32C_USE_GLOG OFF) - set(CRC32C_INSTALL OFF) + #set(CRC32C_INSTALL OFF) fetchcontent_makeavailable(crc32c) + if(CMAKE_VERSION VERSION_LESS 3.28) + set_property(DIRECTORY ${crc32_SOURCE_DIR} PROPERTY EXCLUDE_FROM_ALL TRUE) + endif() + # Create alias target for consistency (crc32c exports as Crc32c::crc32c when installed) if(NOT TARGET Crc32c::crc32c) add_library(Crc32c::crc32c ALIAS crc32c) @@ -3398,25 +3402,25 @@ function(build_google_cloud_cpp_storage) # Apply patch to add GOOGLE_CLOUD_CPP_ENABLE_INSTALL option so it does not install # unconditionally when embedded via FetchContent. Otherwise, we would have to install # dependecies like absl, crc32c, nlohmann_json, etc. which is not desirable. - set(GOOGLE_CLOUD_CPP_PATCH_COMMAND) - find_program(PATCH patch) - if(PATCH) - set(GOOGLE_CLOUD_CPP_PATCH_COMMAND - ${PATCH} -p1 -i ${CMAKE_CURRENT_LIST_DIR}/google-cloud-cpp-disable-install.patch) - else() - find_program(GIT git) - if(GIT) - set(GOOGLE_CLOUD_CPP_PATCH_COMMAND - ${GIT} apply ${CMAKE_CURRENT_LIST_DIR}/google-cloud-cpp-disable-install.patch) - else() - message(FATAL_ERROR "Building google-cloud-cpp from source requires either 'patch' or 'git' to be available" - ) - endif() - endif() + #set(GOOGLE_CLOUD_CPP_PATCH_COMMAND) + #find_program(PATCH patch) + #if(PATCH) + # set(GOOGLE_CLOUD_CPP_PATCH_COMMAND + # ${PATCH} -p1 -i ${CMAKE_CURRENT_LIST_DIR}/google-cloud-cpp-disable-install.patch) + #else() + # find_program(GIT git) + # if(GIT) + # set(GOOGLE_CLOUD_CPP_PATCH_COMMAND + # ${GIT} apply ${CMAKE_CURRENT_LIST_DIR}/google-cloud-cpp-disable-install.patch) + # else() + # message(FATAL_ERROR "Building google-cloud-cpp from source requires either 'patch' or 'git' to be available" + # ) + # endif() + #endif() fetchcontent_declare(google_cloud_cpp ${FC_DECLARE_COMMON_OPTIONS} - PATCH_COMMAND ${GOOGLE_CLOUD_CPP_PATCH_COMMAND} + #PATCH_COMMAND ${GOOGLE_CLOUD_CPP_PATCH_COMMAND} URL ${google_cloud_cpp_storage_SOURCE_URL} URL_HASH "SHA256=${ARROW_GOOGLE_CLOUD_CPP_BUILD_SHA256_CHECKSUM}") @@ -3429,13 +3433,17 @@ function(build_google_cloud_cpp_storage) set(GOOGLE_CLOUD_CPP_ENABLE_WERROR OFF) set(GOOGLE_CLOUD_CPP_WITH_MOCKS OFF) # Disable installation when embedded via FetchContent - set(GOOGLE_CLOUD_CPP_ENABLE_INSTALL OFF) + # set(GOOGLE_CLOUD_CPP_ENABLE_INSTALL OFF) set(BUILD_TESTING OFF) # Unity build causes some build errors. set(CMAKE_UNITY_BUILD FALSE) fetchcontent_makeavailable(google_cloud_cpp) + if(CMAKE_VERSION VERSION_LESS 3.28) + set_property(DIRECTORY ${google_cloud_cpp_SOURCE_DIR} PROPERTY EXCLUDE_FROM_ALL TRUE) + endif() + # Remove unused directories to save build directory storage. # 141MB -> 79MB file(REMOVE_RECURSE "${google_cloud_cpp_SOURCE_DIR}/ci") From 1327ea452dc20eb97831c773a20d349f65f8b91b Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Thu, 11 Dec 2025 06:00:35 +0900 Subject: [PATCH 11/16] Set EXCLUDE_FROM_ALL for Abseil --- cpp/cmake_modules/ThirdpartyToolchain.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index 83e3f04cbb45..7ebb4b28e7ad 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -3048,6 +3048,9 @@ function(build_absl) set(ABSL_ENABLE_INSTALL OFF) fetchcontent_makeavailable(absl) + if(CMAKE_VERSION VERSION_LESS 3.28) + set_property(DIRECTORY ${absl_SOURCE_DIR} PROPERTY EXCLUDE_FROM_ALL TRUE) + endif() if(APPLE) # This is due to upstream absl::cctz issue # https://github.com/abseil/abseil-cpp/issues/283 From f6304d7ce0358938116c07082cad9b5a981f106d Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Thu, 11 Dec 2025 06:14:47 +0900 Subject: [PATCH 12/16] Enable Abseil install --- cpp/cmake_modules/ThirdpartyToolchain.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index 7ebb4b28e7ad..6b71d24fdec7 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -3045,7 +3045,9 @@ function(build_absl) prepare_fetchcontent() - set(ABSL_ENABLE_INSTALL OFF) + # We have to enable Abseil install to add Abseil targets to an export set. + # But we don't install Abseil by EXCLUDE_FROM_ALL. + set(ABSL_ENABLE_INSTALL ON) fetchcontent_makeavailable(absl) if(CMAKE_VERSION VERSION_LESS 3.28) From 58cccddc434c1a60c23218b961c97936d1f697d1 Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Thu, 11 Dec 2025 10:43:51 +0900 Subject: [PATCH 13/16] Fix a typo --- cpp/cmake_modules/ThirdpartyToolchain.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index 6b71d24fdec7..66d989f3e231 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -3302,7 +3302,7 @@ function(build_crc32c_once) fetchcontent_makeavailable(crc32c) if(CMAKE_VERSION VERSION_LESS 3.28) - set_property(DIRECTORY ${crc32_SOURCE_DIR} PROPERTY EXCLUDE_FROM_ALL TRUE) + set_property(DIRECTORY ${crc32c_SOURCE_DIR} PROPERTY EXCLUDE_FROM_ALL TRUE) endif() # Create alias target for consistency (crc32c exports as Crc32c::crc32c when installed) From eab1602080c83db8f505d7a5ec7edde664e83146 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Thu, 11 Dec 2025 11:31:22 +0100 Subject: [PATCH 14/16] Use time instead of absl_time due to ABSL_ENABLE_INSTALL=ON --- cpp/cmake_modules/ThirdpartyToolchain.cmake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index 66d989f3e231..4761e8cd0e3b 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -3057,8 +3057,9 @@ function(build_absl) # This is due to upstream absl::cctz issue # https://github.com/abseil/abseil-cpp/issues/283 find_library(CoreFoundation CoreFoundation) - # The time target (for absl::time) needs CoreFoundation on macOS - set_property(TARGET absl_time + # When ABSL_ENABLE_INSTALL is ON, the real target is "time" not "absl_time" + # Cannot use set_property on alias targets (absl::time is an alias) + set_property(TARGET time APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${CoreFoundation}) endif() From 736f045c71b3727f5a53adad123248a1dab38317 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Thu, 11 Dec 2025 13:41:20 +0100 Subject: [PATCH 15/16] Remove all remnants from unnecessary patch --- ci/scripts/r_docker_configure.sh | 3 +- cpp/cmake_modules/ThirdpartyToolchain.cmake | 21 -- .../google-cloud-cpp-disable-install.patch | 181 ------------------ 3 files changed, 1 insertion(+), 204 deletions(-) delete mode 100644 cpp/cmake_modules/google-cloud-cpp-disable-install.patch diff --git a/ci/scripts/r_docker_configure.sh b/ci/scripts/r_docker_configure.sh index a1a6d8f21c15..3039291ebbd8 100755 --- a/ci/scripts/r_docker_configure.sh +++ b/ci/scripts/r_docker_configure.sh @@ -73,8 +73,7 @@ fi # Install rsync for bundling cpp source and curl to make sure it is installed on all images, # cmake is now a listed sys req. -# Install patch/git for applying patches to bundled dependencies via FetchContent. -$PACKAGE_MANAGER install -y rsync cmake curl git patch +$PACKAGE_MANAGER install -y rsync cmake curl # Update clang version to latest available. # This is only for rhub/clang20. If we change the base image from rhub/clang20, diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index 4761e8cd0e3b..562566d33fd7 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -3299,7 +3299,6 @@ function(build_crc32c_once) set(CRC32C_BUILD_TESTS OFF) set(CRC32C_BUILD_BENCHMARKS OFF) set(CRC32C_USE_GLOG OFF) - #set(CRC32C_INSTALL OFF) fetchcontent_makeavailable(crc32c) if(CMAKE_VERSION VERSION_LESS 3.28) @@ -3405,28 +3404,8 @@ function(build_google_cloud_cpp_storage) # For now, force its inclusion from the underlying system or fail. find_curl() - # Apply patch to add GOOGLE_CLOUD_CPP_ENABLE_INSTALL option so it does not install - # unconditionally when embedded via FetchContent. Otherwise, we would have to install - # dependecies like absl, crc32c, nlohmann_json, etc. which is not desirable. - #set(GOOGLE_CLOUD_CPP_PATCH_COMMAND) - #find_program(PATCH patch) - #if(PATCH) - # set(GOOGLE_CLOUD_CPP_PATCH_COMMAND - # ${PATCH} -p1 -i ${CMAKE_CURRENT_LIST_DIR}/google-cloud-cpp-disable-install.patch) - #else() - # find_program(GIT git) - # if(GIT) - # set(GOOGLE_CLOUD_CPP_PATCH_COMMAND - # ${GIT} apply ${CMAKE_CURRENT_LIST_DIR}/google-cloud-cpp-disable-install.patch) - # else() - # message(FATAL_ERROR "Building google-cloud-cpp from source requires either 'patch' or 'git' to be available" - # ) - # endif() - #endif() - fetchcontent_declare(google_cloud_cpp ${FC_DECLARE_COMMON_OPTIONS} - #PATCH_COMMAND ${GOOGLE_CLOUD_CPP_PATCH_COMMAND} URL ${google_cloud_cpp_storage_SOURCE_URL} URL_HASH "SHA256=${ARROW_GOOGLE_CLOUD_CPP_BUILD_SHA256_CHECKSUM}") diff --git a/cpp/cmake_modules/google-cloud-cpp-disable-install.patch b/cpp/cmake_modules/google-cloud-cpp-disable-install.patch deleted file mode 100644 index 694713988461..000000000000 --- a/cpp/cmake_modules/google-cloud-cpp-disable-install.patch +++ /dev/null @@ -1,181 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 3816333816..3e620b20a7 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -52,6 +52,11 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") - endif () - endif () - -+option(GOOGLE_CLOUD_CPP_ENABLE_INSTALL -+ "Enable installation of google-cloud-cpp headers and libraries" -+ ON) -+mark_as_advanced(GOOGLE_CLOUD_CPP_ENABLE_INSTALL) -+ - list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) - include(SelectMSVCRuntime) - -diff --git a/cmake/GoogleCloudCppLibrary.cmake b/cmake/GoogleCloudCppLibrary.cmake -index caee116a3a..fe62e3b4d1 100644 ---- a/cmake/GoogleCloudCppLibrary.cmake -+++ b/cmake/GoogleCloudCppLibrary.cmake -@@ -87,6 +87,7 @@ function (google_cloud_cpp_add_library_protos library) - set(library_target "google_cloud_cpp_${library}") - - # Export the CMake targets to make it easy to create configuration files. -+ if(GOOGLE_CLOUD_CPP_ENABLE_INSTALL) - install( - EXPORT ${library_target}-targets - DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${library_target}" -@@ -104,6 +105,7 @@ function (google_cloud_cpp_add_library_protos library) - NAMELINK_COMPONENT google_cloud_cpp_development - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - COMPONENT google_cloud_cpp_development) -+ endif() - - # Create and install the CMake configuration files. - include(CMakePackageConfigHelpers) -@@ -115,12 +117,14 @@ function (google_cloud_cpp_add_library_protos library) - VERSION ${PROJECT_VERSION} - COMPATIBILITY ExactVersion) - -+ if(GOOGLE_CLOUD_CPP_ENABLE_INSTALL) - install( - FILES - "${CMAKE_CURRENT_BINARY_DIR}/${library_target}-config.cmake" - "${CMAKE_CURRENT_BINARY_DIR}/${library_target}-config-version.cmake" - DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${library_target}" - COMPONENT google_cloud_cpp_development) -+ endif() - endfunction () - - # -@@ -257,6 +261,8 @@ function (google_cloud_cpp_add_gapic_library library display_name) - include(GNUInstallDirs) - - # Export the CMake targets to make it easy to create configuration files. -+ -+ if(GOOGLE_CLOUD_CPP_ENABLE_INSTALL) - install( - EXPORT ${library_target}-targets - DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${library_target}" -@@ -278,6 +284,7 @@ function (google_cloud_cpp_add_gapic_library library display_name) - - google_cloud_cpp_install_headers("${library_target}" - "include/google/cloud/${library}") -+ endif() - - google_cloud_cpp_add_pkgconfig( - ${library} -@@ -311,12 +318,14 @@ function (google_cloud_cpp_add_gapic_library library display_name) - VERSION ${PROJECT_VERSION} - COMPATIBILITY ExactVersion) - -+ if(GOOGLE_CLOUD_CPP_ENABLE_INSTALL) - install( - FILES - "${CMAKE_CURRENT_BINARY_DIR}/${library_target}-config.cmake" - "${CMAKE_CURRENT_BINARY_DIR}/${library_target}-config-version.cmake" - DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${library_target}" - COMPONENT google_cloud_cpp_development) -+ endif() - - if (GOOGLE_CLOUD_CPP_WITH_MOCKS) - # Create a header-only library for the mocks. We use a CMake `INTERFACE` -diff --git a/google/cloud/google_cloud_cpp_common.cmake b/google/cloud/google_cloud_cpp_common.cmake -index 5bbc510e18..5ced623d9e 100644 ---- a/google/cloud/google_cloud_cpp_common.cmake -+++ b/google/cloud/google_cloud_cpp_common.cmake -@@ -218,6 +218,7 @@ add_library(google-cloud-cpp::common ALIAS google_cloud_cpp_common) - - create_bazel_config(google_cloud_cpp_common YEAR 2018) - -+if(GOOGLE_CLOUD_CPP_ENABLE_INSTALL) - # Export the CMake targets to make it easy to create configuration files. - install( - EXPORT google_cloud_cpp_common-targets -@@ -265,6 +266,7 @@ install( - "${CMAKE_CURRENT_BINARY_DIR}/google_cloud_cpp_common-config-version.cmake" - DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/google_cloud_cpp_common" - COMPONENT google_cloud_cpp_development) -+endif() - - if (GOOGLE_CLOUD_CPP_WITH_MOCKS) - # Create a header-only library for the mocks. We use a CMake `INTERFACE` -diff --git a/google/cloud/google_cloud_cpp_rest_internal.cmake b/google/cloud/google_cloud_cpp_rest_internal.cmake -index 5da42523bf..726b0dceec 100644 ---- a/google/cloud/google_cloud_cpp_rest_internal.cmake -+++ b/google/cloud/google_cloud_cpp_rest_internal.cmake -@@ -142,6 +142,7 @@ set_target_properties( - add_library(google-cloud-cpp::rest_internal ALIAS - google_cloud_cpp_rest_internal) - -+if(GOOGLE_CLOUD_CPP_ENABLE_INSTALL) - # Export the CMake targets to make it easy to create configuration files. - install( - EXPORT google_cloud_cpp_rest_internal-targets -@@ -184,6 +185,7 @@ install( - "${CMAKE_CURRENT_BINARY_DIR}/google_cloud_cpp_rest_internal-config-version.cmake" - DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/google_cloud_cpp_rest_internal" - COMPONENT google_cloud_cpp_development) -+endif() - - create_bazel_config(google_cloud_cpp_rest_internal YEAR 2021) - -diff --git a/google/cloud/storage/google_cloud_cpp_storage.cmake b/google/cloud/storage/google_cloud_cpp_storage.cmake -index 8e69ad26b6..272fe3f100 100644 ---- a/google/cloud/storage/google_cloud_cpp_storage.cmake -+++ b/google/cloud/storage/google_cloud_cpp_storage.cmake -@@ -296,6 +296,7 @@ add_library(google-cloud-cpp::storage ALIAS google_cloud_cpp_storage) - - create_bazel_config(google_cloud_cpp_storage) - -+if(GOOGLE_CLOUD_CPP_ENABLE_INSTALL) - # Export the CMake targets to make it easy to create configuration files. - install( - EXPORT storage-targets -@@ -372,7 +373,7 @@ install( - FILES testing/mock_client.h - DESTINATION include/google/cloud/storage/testing - COMPONENT google_cloud_cpp_development) -- -+endif() - if (BUILD_TESTING) - add_library( - storage_client_testing # cmake-format: sort -diff --git a/google/cloud/storage/google_cloud_cpp_storage_grpc.cmake b/google/cloud/storage/google_cloud_cpp_storage_grpc.cmake -index 680a771a8f..fcea826890 100644 ---- a/google/cloud/storage/google_cloud_cpp_storage_grpc.cmake -+++ b/google/cloud/storage/google_cloud_cpp_storage_grpc.cmake -@@ -192,6 +192,7 @@ endif () - add_library(google-cloud-cpp::experimental-storage_grpc ALIAS - google_cloud_cpp_storage_grpc) - -+ if(GOOGLE_CLOUD_CPP_ENABLE_INSTALL) - google_cloud_cpp_add_pkgconfig( - storage_grpc - "The GCS (Google Cloud Storage) gRPC plugin" -@@ -218,6 +219,7 @@ install( - - google_cloud_cpp_install_headers(google_cloud_cpp_storage_grpc - include/google/cloud/storage) -+endif() - - if (GOOGLE_CLOUD_CPP_WITH_MOCKS) - # Create a header-only library for the mocks. We use a CMake `INTERFACE` From 9958f52f36c739641cd7d36ae2c034a31b0702dd Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Tue, 16 Dec 2025 10:15:33 +0900 Subject: [PATCH 16/16] Add a new line --- cpp/cmake_modules/ThirdpartyToolchain.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index 562566d33fd7..aa5c426aff31 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -3053,6 +3053,7 @@ function(build_absl) if(CMAKE_VERSION VERSION_LESS 3.28) set_property(DIRECTORY ${absl_SOURCE_DIR} PROPERTY EXCLUDE_FROM_ALL TRUE) endif() + if(APPLE) # This is due to upstream absl::cctz issue # https://github.com/abseil/abseil-cpp/issues/283