@@ -1011,9 +1011,6 @@ if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.28)
10111011endif ()
10121012
10131013macro (prepare_fetchcontent)
1014- set (_SAVED_CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} " )
1015- set (_SAVED_CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY} " )
1016- set (_SAVED_CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY} " )
10171014 set (BUILD_SHARED_LIBS OFF )
10181015 set (BUILD_STATIC_LIBS ON )
10191016 set (BUILD_TESTING OFF )
@@ -1046,14 +1043,6 @@ macro(prepare_fetchcontent)
10461043 endif ()
10471044endmacro ()
10481045
1049- macro (cleanup_fetchcontent)
1050- # Restore output directories
1051- # TODO: Investigate why without this tests fail to get correctly installed
1052- set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${_SAVED_CMAKE_ARCHIVE_OUTPUT_DIRECTORY} " )
1053- set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${_SAVED_CMAKE_LIBRARY_OUTPUT_DIRECTORY} " )
1054- set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${_SAVED_CMAKE_RUNTIME_OUTPUT_DIRECTORY} " )
1055- endmacro ()
1056-
10571046# ----------------------------------------------------------------------
10581047# Find pthreads
10591048
@@ -3004,17 +2993,16 @@ endmacro()
30042993# ----------------------------------------------------------------------
30052994# Dependencies for Arrow Flight RPC
30062995
3007- macro (build_absl)
2996+ function (build_absl)
2997+ list (APPEND CMAKE_MESSAGE_INDENT "ABSL: " )
30082998 message (STATUS "Building Abseil from source using FetchContent" )
3009- set (ABSL_VENDORED TRUE )
3010- set (ABSL_PREFIX "${CMAKE_CURRENT_BINARY_DIR} /absl_ep-install" )
3011- set (ABSL_INCLUDE_DIR "${ABSL_PREFIX} /include" )
3012-
3013- # Configure Abseil options before FetchContent
3014- set (ABSL_PROPAGATE_CXX_STD ON )
3015- # We have to enable Abseil install to generate abslConfig.cmake
3016- # so gRPC can find Abseil thorught ExternalProject_Add
3017- set (ABSL_ENABLE_INSTALL ON )
2999+ set (ABSL_VENDORED
3000+ TRUE
3001+ PARENT_SCOPE)
3002+ set (ABSL_PREFIX "${CMAKE_CURRENT_BINARY_DIR} /absl_fc-install" )
3003+ set (ABSL_PREFIX
3004+ "${ABSL_PREFIX} "
3005+ PARENT_SCOPE)
30183006
30193007 if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.0)
30203008 string (APPEND CMAKE_CXX_FLAGS " -include stdint.h" )
@@ -3026,14 +3014,12 @@ macro(build_absl)
30263014
30273015 prepare_fetchcontent()
30283016
3029- set (CMAKE_INSTALL_PREFIX_SAVED "${CMAKE_INSTALL_PREFIX} " )
3030- set (CMAKE_INSTALL_PREFIX "${ABSL_PREFIX} " )
3017+ # We have to enable Abseil install to generate abslConfig.cmake
3018+ # so gRPC can find Abseil through ExternalProject_Add. Our expectation
3019+ # is that this will not be necessary once gRPC supports FetchContent.
3020+ set (ABSL_ENABLE_INSTALL ON )
30313021 fetchcontent_makeavailable(absl)
30323022
3033- # Restore original install prefix
3034- set (CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX_SAVED} " )
3035- cleanup_fetchcontent()
3036-
30373023 # This custom target is required due to a timing issue between FetchContent
30383024 # and the install command below, which is necessary for GRPC to find Abseil
30393025 # due to mixing FetchContent and ExternalProject_Add.
@@ -3143,8 +3129,8 @@ macro(build_absl)
31433129 COMMENT "Installing Abseil to ${ABSL_PREFIX} for gRPC"
31443130 VERBATIM )
31453131
3146- # Make absl_ep depend on the install completion marker
3147- add_custom_target (absl_ep DEPENDS "${ABSL_PREFIX} /.absl_installed" )
3132+ # Make absl_fc depend on the install completion marker
3133+ add_custom_target (absl_fc DEPENDS "${ABSL_PREFIX} /.absl_installed" )
31483134
31493135 if (APPLE )
31503136 # This is due to upstream absl::cctz issue
@@ -3154,7 +3140,8 @@ macro(build_absl)
31543140 APPEND
31553141 PROPERTY INTERFACE_LINK_LIBRARIES ${CoreFoundation} )
31563142 endif ()
3157- endmacro ()
3143+ list (POP_BACK CMAKE_MESSAGE_INDENT)
3144+ endfunction ()
31583145
31593146macro (build_grpc)
31603147 resolve_dependency(c-ares
@@ -3199,7 +3186,7 @@ macro(build_grpc)
31993186 add_custom_target (grpc_dependencies)
32003187
32013188 if (ABSL_VENDORED)
3202- add_dependencies (grpc_dependencies absl_ep )
3189+ add_dependencies (grpc_dependencies absl_fc )
32033190 endif ()
32043191 if (CARES_VENDORED)
32053192 add_dependencies (grpc_dependencies cares_ep)
@@ -3658,7 +3645,7 @@ macro(build_google_cloud_cpp_storage)
36583645 add_custom_target (google_cloud_cpp_dependencies)
36593646
36603647 if (ABSL_VENDORED)
3661- add_dependencies (google_cloud_cpp_dependencies absl_ep )
3648+ add_dependencies (google_cloud_cpp_dependencies absl_fc )
36623649 endif ()
36633650 if (ZLIB_VENDORED)
36643651 add_dependencies (google_cloud_cpp_dependencies zlib_ep)
0 commit comments