kou commented on code in PR #48333:
URL: https://github.com/apache/arrow/pull/48333#discussion_r2621364803
##########
cpp/cmake_modules/ThirdpartyToolchain.cmake:
##########
@@ -3033,139 +3033,26 @@ 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.
+ # 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)
- # 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=$<CONFIG> -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(CMAKE_VERSION VERSION_LESS 3.28)
+ set_property(DIRECTORY ${absl_SOURCE_DIR} PROPERTY EXCLUDE_FROM_ALL TRUE)
+ endif()
Review Comment:
```suggestion
endif()
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]