kou commented on code in PR #46912:
URL: https://github.com/apache/arrow/pull/46912#discussion_r2191229151


##########
cpp/cmake_modules/ThirdpartyToolchain.cmake:
##########
@@ -1052,119 +1045,130 @@ endif()
 # ----------------------------------------------------------------------
 # Add Boost dependencies (code adapted from Apache Kudu)
 
-macro(build_boost)
-  set(BOOST_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/boost_ep-prefix/src/boost_ep")
+function(build_boost)
+  list(APPEND CMAKE_MESSAGE_INDENT "Boost: ")
+  message(STATUS "Building from source")
 
-  # This is needed by the thrift_ep build
-  set(BOOST_ROOT ${BOOST_PREFIX})
-  set(Boost_INCLUDE_DIR "${BOOST_PREFIX}")
+  fetchcontent_declare(boost
+                       ${FC_DECLARE_COMMON_OPTIONS} OVERRIDE_FIND_PACKAGE
+                       URL ${BOOST_SOURCE_URL}
+                       URL_HASH "SHA256=${ARROW_BOOST_BUILD_SHA256_CHECKSUM}")
 
-  if(ARROW_BOOST_REQUIRE_LIBRARY)
-    set(BOOST_LIB_DIR "${BOOST_PREFIX}/stage/lib")
-    set(BOOST_BUILD_LINK "static")
-    if("${UPPERCASE_BUILD_TYPE}" STREQUAL "DEBUG")
-      set(BOOST_BUILD_VARIANT "debug")
-    else()
-      set(BOOST_BUILD_VARIANT "release")
+  prepare_fetchcontent()
+  set(BOOST_ENABLE_COMPATIBILITY_TARGETS ON)
+  set(BOOST_EXCLUDE_LIBRARIES)
+  set(BOOST_INCLUDE_LIBRARIES
+      ${ARROW_BOOST_COMPONENTS}
+      ${ARROW_BOOST_OPTIONAL_COMPONENTS}
+      algorithm
+      crc
+      numeric/conversion
+      scope_exit
+      throw_exception
+      tokenizer)
+  if(ARROW_TESTING
+     OR ARROW_GANDIVA
+     OR (NOT ARROW_USE_NATIVE_INT128))
+    set(ARROW_BOOST_NEED_MULTIPRECISION TRUE)
+  else()
+    set(ARROW_BOOST_NEED_MULTIPRECISION FALSE)
+  endif()
+  if(ARROW_ENABLE_THREADING)
+    if(ARROW_WITH_THRIFT OR (ARROW_FLIGHT_SQL_ODBC AND MSVC))
+      list(APPEND BOOST_INCLUDE_LIBRARIES locale)
     endif()
-    if(MSVC)
-      set(BOOST_CONFIGURE_COMMAND ".\\\\bootstrap.bat")
-    else()
-      set(BOOST_CONFIGURE_COMMAND "./bootstrap.sh")
+    if(ARROW_BOOST_NEED_MULTIPRECISION)
+      list(APPEND BOOST_INCLUDE_LIBRARIES multiprecision)
     endif()
+    list(APPEND BOOST_INCLUDE_LIBRARIES thread)
+  else()
+    list(APPEND
+         BOOST_EXCLUDE_LIBRARIES
+         asio
+         container
+         date_time
+         lexical_cast
+         locale
+         lockfree
+         math
+         thread)
+  endif()
+  if(ARROW_WITH_THRIFT)
+    list(APPEND BOOST_INCLUDE_LIBRARIES uuid)
+  endif()

Review Comment:
   It worked.



-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to