You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ko...@apache.org on 2022/10/20 21:43:48 UTC

[arrow] 01/13: ARROW-18072: [C++] Can't use bundled ORC with CMake 3.10 (#14432)

This is an automated email from the ASF dual-hosted git repository.

kou pushed a commit to branch maint-10.0.0
in repository https://gitbox.apache.org/repos/asf/arrow.git

commit 4a985ff98900d289d4bf704c25c2d7f9511733da
Author: Sutou Kouhei <ko...@clear-code.com>
AuthorDate: Mon Oct 17 14:54:34 2022 +0900

    ARROW-18072: [C++] Can't use bundled ORC with CMake 3.10 (#14432)
    
    Because CMake 3.10 doesn't support target_link_libraries() against an IMPORTED target:
    
    https://cmake.org/cmake/help/latest/release/3.11.html#commands
    
    > The target_link_libraries() command learned to set the
    > INTERFACE_LINK_LIBRARIES property on Imported Targets.
    
    Authored-by: Sutou Kouhei <ko...@clear-code.com>
    Signed-off-by: Sutou Kouhei <ko...@clear-code.com>
---
 cpp/cmake_modules/ThirdpartyToolchain.cmake | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake
index 1c9670208a..b7cd31f3d7 100644
--- a/cpp/cmake_modules/ThirdpartyToolchain.cmake
+++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake
@@ -4338,13 +4338,18 @@ macro(build_orc)
   set_target_properties(orc::liborc
                         PROPERTIES IMPORTED_LOCATION "${ORC_STATIC_LIB}"
                                    INTERFACE_INCLUDE_DIRECTORIES "${ORC_INCLUDE_DIR}")
-  target_link_libraries(orc::liborc INTERFACE LZ4::lz4 ZLIB::ZLIB ${ARROW_ZSTD_LIBZSTD}
-                                              ${Snappy_TARGET})
+  set(ORC_LINK_LIBRARIES LZ4::lz4 ZLIB::ZLIB ${ARROW_ZSTD_LIBZSTD} ${Snappy_TARGET})
   if(NOT MSVC)
     if(NOT APPLE)
-      target_link_libraries(orc::liborc INTERFACE Threads::Threads)
+      list(APPEND ORC_LINK_LIBRARIES Threads::Threads)
     endif()
-    target_link_libraries(orc::liborc INTERFACE ${CMAKE_DL_LIBS})
+    list(APPEND ORC_LINK_LIBRARIES ${CMAKE_DL_LIBS})
+  endif()
+  if(CMAKE_VERSION VERSION_LESS 3.11)
+    set_target_properties(orc::liborc PROPERTIES INTERFACE_LINK_LIBRARIES
+                                                 "${ORC_LINK_LIBRARIES}")
+  else()
+    target_link_libraries(orc::liborc INTERFACE ${ORC_LINK_LIBRARIES})
   endif()
 
   add_dependencies(toolchain orc_ep)