@@ -607,8 +607,6 @@ else()
607
607
# our currently used packages and doesn't fall out of sync with
608
608
# ${ARROW_BOOST_BUILD_VERSION_UNDERSCORES}
609
609
"${THIRDPARTY_MIRROR_URL} /boost_${ARROW_BOOST_BUILD_VERSION_UNDERSCORES} .tar.gz"
610
- "https://boostorg.jfrog.io/artifactory/main/release/${ARROW_BOOST_BUILD_VERSION} /source/boost_${ARROW_BOOST_BUILD_VERSION_UNDERSCORES} .tar.gz"
611
- "https://sourceforge.net/projects/boost/files/boost/${ARROW_BOOST_BUILD_VERSION} /boost_${ARROW_BOOST_BUILD_VERSION_UNDERSCORES} .tar.gz"
612
610
)
613
611
endif ()
614
612
@@ -2652,33 +2650,40 @@ if(ARROW_WITH_ZLIB)
2652
2650
endif ()
2653
2651
2654
2652
macro (build_lz4)
2655
- message (STATUS "Building LZ4 from source" )
2653
+ message (STATUS "Building LZ4 from source using FetchContent " )
2656
2654
2657
- set (LZ4_PREFIX "${CMAKE_CURRENT_BINARY_DIR} /lz4_ep-install" )
2655
+ # Set LZ4 as vendored
2656
+ set (LZ4_VENDORED TRUE )
2658
2657
2659
- set (LZ4_STATIC_LIB
2660
- "${LZ4_PREFIX} /lib/${CMAKE_STATIC_LIBRARY_PREFIX} lz4${CMAKE_STATIC_LIBRARY_SUFFIX} " )
2658
+ # Declare the content
2659
+ fetchcontent_declare(lz4
2660
+ URL ${LZ4_SOURCE_URL}
2661
+ URL_HASH "SHA256=${ARROW_LZ4_BUILD_SHA256_CHECKSUM} "
2662
+ SOURCE_SUBDIR "build/cmake" )
2661
2663
2662
- set (LZ4_CMAKE_ARGS ${EP_COMMON_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
2663
- -DLZ4_BUILD_CLI= OFF -DLZ4_BUILD_LEGACY_LZ4C= OFF )
2664
+ # Prepare fetch content environment
2665
+ prepare_fetchcontent( )
2664
2666
2665
- # We need to copy the header in lib to directory outside of the build
2666
- externalproject_add(lz4_ep
2667
- ${EP_COMMON_OPTIONS}
2668
- CMAKE_ARGS ${LZ4_CMAKE_ARGS}
2669
- SOURCE_SUBDIR "build/cmake"
2670
- INSTALL_DIR ${LZ4_PREFIX}
2671
- URL ${LZ4_SOURCE_URL}
2672
- URL_HASH "SHA256=${ARROW_LZ4_BUILD_SHA256_CHECKSUM} "
2673
- BUILD_BYPRODUCTS ${LZ4_STATIC_LIB} )
2674
-
2675
- file (MAKE_DIRECTORY "${LZ4_PREFIX} /include" )
2676
- add_library (LZ4::lz4 STATIC IMPORTED )
2677
- set_target_properties (LZ4::lz4 PROPERTIES IMPORTED_LOCATION "${LZ4_STATIC_LIB} " )
2678
- target_include_directories (LZ4::lz4 BEFORE INTERFACE "${LZ4_PREFIX} /include" )
2679
- add_dependencies (LZ4::lz4 lz4_ep)
2680
-
2681
- list (APPEND ARROW_BUNDLED_STATIC_LIBS LZ4::lz4)
2667
+ # Set LZ4-specific build options as cache variables
2668
+ set (LZ4_BUILD_CLI
2669
+ OFF
2670
+ CACHE BOOL "Don't build LZ4 CLI" FORCE)
2671
+ set (LZ4_BUILD_LEGACY_LZ4C
2672
+ OFF
2673
+ CACHE BOOL "Don't build legacy LZ4 tools" FORCE)
2674
+
2675
+ # Make the dependency available - this will actually perform the download and configure
2676
+ fetchcontent_makeavailable(lz4)
2677
+
2678
+ # Use LZ4::lz4 as an imported library not an alias of lz4_static so other targets such as orc
2679
+ # can depend on it as an external library. External libraries are ignored in
2680
+ # install(TARGETS orc EXPORT orc_targets) and install(EXPORT orc_targets).
2681
+ add_library (LZ4::lz4 INTERFACE IMPORTED )
2682
+ target_link_libraries (LZ4::lz4 INTERFACE lz4_static)
2683
+
2684
+ # Add to bundled static libs.
2685
+ # We must use lz4_static (not imported target) not LZ4::lz4 (imported target).
2686
+ list (APPEND ARROW_BUNDLED_STATIC_LIBS lz4_static)
2682
2687
endmacro ()
2683
2688
2684
2689
if (ARROW_WITH_LZ4)
@@ -2908,7 +2913,7 @@ endmacro()
2908
2913
2909
2914
if (ARROW_WITH_UTF8PROC)
2910
2915
set (utf8proc_resolve_dependency_args utf8proc PC_PACKAGE_NAMES libutf8proc)
2911
- if (NOT VCPKG_TOOLCHAIN )
2916
+ if (NOT ARROW_VCPKG )
2912
2917
# utf8proc in vcpkg doesn't provide version information:
2913
2918
# https://github.com/microsoft/vcpkg/issues/39176
2914
2919
list (APPEND utf8proc_resolve_dependency_args REQUIRED_VERSION "2.2.0" )
@@ -4589,6 +4594,17 @@ target_include_directories(arrow::hadoop INTERFACE "${HADOOP_HOME}/include")
4589
4594
function (build_orc)
4590
4595
message (STATUS "Building Apache ORC from source" )
4591
4596
4597
+ if (LZ4_VENDORED)
4598
+ set (ORC_LZ4_TARGET lz4_static)
4599
+ set (ORC_LZ4_ROOT "${lz4_SOURCE_DIR} " )
4600
+ set (ORC_LZ4_INCLUDE_DIR "${lz4_SOURCE_DIR} /lib" )
4601
+ else ()
4602
+ set (ORC_LZ4_TARGET LZ4::lz4)
4603
+ get_target_property (ORC_LZ4_INCLUDE_DIR ${ORC_LZ4_TARGET}
4604
+ INTERFACE_INCLUDE_DIRECTORIES )
4605
+ get_filename_component (ORC_LZ4_ROOT "${ORC_LZ4_INCLUDE_DIR} " DIRECTORY )
4606
+ endif ()
4607
+
4592
4608
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.29)
4593
4609
fetchcontent_declare(orc
4594
4610
${FC_DECLARE_COMMON_OPTIONS}
@@ -4601,16 +4617,14 @@ function(build_orc)
4601
4617
set (ORC_PREFER_STATIC_LZ4
4602
4618
OFF
4603
4619
CACHE BOOL "" FORCE)
4604
- get_target_property (LZ4_INCLUDE_DIR LZ4::lz4 INTERFACE_INCLUDE_DIRECTORIES )
4605
- if (NOT LZ4_INCLUDE_DIR)
4606
- find_path (LZ4_INCLUDE_DIR NAMES lz4.h)
4607
- endif ()
4608
- get_filename_component (LZ4_ROOT "${LZ4_INCLUDE_DIR} " DIRECTORY )
4609
4620
set (LZ4_HOME
4610
- "${LZ4_ROOT} "
4621
+ "${ORC_LZ4_ROOT} "
4622
+ CACHE STRING "" FORCE)
4623
+ set (LZ4_INCLUDE_DIR
4624
+ "${ORC_LZ4_INCLUDE_DIR} "
4611
4625
CACHE STRING "" FORCE)
4612
4626
set (LZ4_LIBRARY
4613
- LZ4::lz4
4627
+ ${ORC_LZ4_TARGET}
4614
4628
CACHE STRING "" FORCE)
4615
4629
4616
4630
set (ORC_PREFER_STATIC_PROTOBUF
@@ -4709,9 +4723,6 @@ function(build_orc)
4709
4723
INTERFACE_INCLUDE_DIRECTORIES )
4710
4724
get_filename_component (ORC_SNAPPY_ROOT "${ORC_SNAPPY_INCLUDE_DIR} " DIRECTORY )
4711
4725
4712
- get_target_property (ORC_LZ4_ROOT LZ4::lz4 INTERFACE_INCLUDE_DIRECTORIES )
4713
- get_filename_component (ORC_LZ4_ROOT "${ORC_LZ4_ROOT} " DIRECTORY )
4714
-
4715
4726
get_target_property (ORC_ZSTD_ROOT ${ARROW_ZSTD_LIBZSTD} INTERFACE_INCLUDE_DIRECTORIES )
4716
4727
get_filename_component (ORC_ZSTD_ROOT "${ORC_ZSTD_ROOT} " DIRECTORY )
4717
4728
@@ -4735,9 +4746,9 @@ function(build_orc)
4735
4746
"-DSNAPPY_HOME=${ORC_SNAPPY_ROOT} "
4736
4747
"-DSNAPPY_LIBRARY=$<TARGET_FILE:${Snappy_TARGET} >"
4737
4748
"-DLZ4_HOME=${ORC_LZ4_ROOT} "
4738
- "-DLZ4_LIBRARY=$<TARGET_FILE:LZ4::lz4 >"
4739
- "-DLZ4_STATIC_LIB=$<TARGET_FILE:LZ4::lz4 >"
4740
- "-DLZ4_INCLUDE_DIR=${ORC_LZ4_ROOT} /include "
4749
+ "-DLZ4_LIBRARY=$<TARGET_FILE:${ORC_LZ4_TARGET} >"
4750
+ "-DLZ4_STATIC_LIB=$<TARGET_FILE:${ORC_LZ4_TARGET} >"
4751
+ "-DLZ4_INCLUDE_DIR=${ORC_LZ4_INCLUDE_DIR} "
4741
4752
"-DSNAPPY_INCLUDE_DIR=${ORC_SNAPPY_INCLUDE_DIR} "
4742
4753
"-DZSTD_HOME=${ORC_ZSTD_ROOT} "
4743
4754
"-DZSTD_INCLUDE_DIR=$<TARGET_PROPERTY:${ARROW_ZSTD_LIBZSTD} ,INTERFACE_INCLUDE_DIRECTORIES>"
0 commit comments