raulcd commented on PR #48092:
URL: https://github.com/apache/arrow/pull/48092#issuecomment-3549129654

   I have a working PoC on [this 
branch](https://github.com/apache/arrow/compare/main...raulcd:arrow:FetchContent-protobuf?expand=1)
 where I have migrated Abseil, c-ares, protobuf, re2 and gRPC and I can reduce 
back c-ares and re2 to something like:
   ```cmake
   function(build_re2)
     list(APPEND CMAKE_MESSAGE_INDENT "RE2: ")
     message(STATUS "Building RE2 from source using FetchContent")
     set(RE2_VENDORED
         TRUE
         PARENT_SCOPE)
   
     fetchcontent_declare(re2
                          URL ${RE2_SOURCE_URL}
                          URL_HASH "SHA256=${ARROW_RE2_BUILD_SHA256_CHECKSUM}")
     prepare_fetchcontent()
     fetchcontent_makeavailable(re2)
   
     set(ARROW_BUNDLED_STATIC_LIBS
         ${ARROW_BUNDLED_STATIC_LIBS} re2::re2
         PARENT_SCOPE)
     list(POP_BACK CMAKE_MESSAGE_INDENT)
   endfunction()
   ```
   and
   ```cmake
   function(build_cares)
     list(APPEND CMAKE_MESSAGE_INDENT "c-ares: ")
     message(STATUS "Building c-ares from source using FetchContent")
     set(CARES_VENDORED
         TRUE
         PARENT_SCOPE)
   
     fetchcontent_declare(cares
                          URL ${CARES_SOURCE_URL}
                          URL_HASH 
"SHA256=${ARROW_CARES_BUILD_SHA256_CHECKSUM}")
     prepare_fetchcontent()
   
     set(CARES_SHARED OFF)
     set(CARES_STATIC ON)
     fetchcontent_makeavailable(cares)
   
     if(APPLE)
       # libresolv must be linked from c-ares version 1.16.1
       find_library(LIBRESOLV_LIBRARY NAMES resolv libresolv REQUIRED)
       set_target_properties(c-ares::cares PROPERTIES INTERFACE_LINK_LIBRARIES
                                                      "${LIBRESOLV_LIBRARY}")
     endif()
   
     set(ARROW_BUNDLED_STATIC_LIBS
         ${ARROW_BUNDLED_STATIC_LIBS} c-ares::cares
         PARENT_SCOPE)
     list(POP_BACK CMAKE_MESSAGE_INDENT)
   endfunction()
   ```
   For Abseil and Protobuf as those are dependencies for other libraries too, 
it will take longer but we should be able to reduce them once everything is 
migrated to `FetchContent`. That branch is just for investigation purposes at 
the moment.


-- 
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]

Reply via email to