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/08/12 04:59:29 UTC

[arrow] branch master updated: ARROW-17367: [C++] Fix the LZ4's CMake target name (#13831)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new d11a55377b ARROW-17367: [C++] Fix the LZ4's CMake target name (#13831)
d11a55377b is described below

commit d11a55377bff0e52606a447e3bb87e8e4cbfb2f7
Author: Sutou Kouhei <ko...@clear-code.com>
AuthorDate: Fri Aug 12 13:59:24 2022 +0900

    ARROW-17367: [C++] Fix the LZ4's CMake target name (#13831)
    
    I changed the LZ4's CMake target name to lz4::lz4 from LZ4::lz4 by
    ARROW-16614 because I thought that the official LZ4's CMake package
    uses lz4::lz4 not LZ4::lz4.
    
    But I was wrong. The official LZ4's CMake package uses LZ4::lz4 not
    lz4::lz4:
    https://github.com/lz4/lz4/commit/f9378137ed306ea71d1d9cd60e1acf7b8e57f0df
    
    Authored-by: Sutou Kouhei <ko...@clear-code.com>
    Signed-off-by: Sutou Kouhei <ko...@clear-code.com>
---
 cpp/CMakeLists.txt                          |  4 ++--
 cpp/cmake_modules/Findlz4Alt.cmake          | 10 +++++++---
 cpp/cmake_modules/ThirdpartyToolchain.cmake | 12 ++++++------
 cpp/src/arrow/adapters/orc/CMakeLists.txt   |  2 +-
 4 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index 9cc5173737..9e732db80a 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -753,9 +753,9 @@ if(ARROW_WITH_BZ2)
 endif()
 
 if(ARROW_WITH_LZ4)
-  list(APPEND ARROW_STATIC_LINK_LIBS lz4::lz4)
+  list(APPEND ARROW_STATIC_LINK_LIBS LZ4::lz4)
   if(lz4_SOURCE STREQUAL "SYSTEM")
-    list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS lz4::lz4)
+    list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS LZ4::lz4)
   endif()
 endif()
 
diff --git a/cpp/cmake_modules/Findlz4Alt.cmake b/cpp/cmake_modules/Findlz4Alt.cmake
index 186fec7e40..9fe8a31c1d 100644
--- a/cpp/cmake_modules/Findlz4Alt.cmake
+++ b/cpp/cmake_modules/Findlz4Alt.cmake
@@ -25,6 +25,10 @@ endif()
 find_package(lz4 ${find_package_args})
 if(lz4_FOUND)
   set(lz4Alt_FOUND TRUE)
+  # Conan uses lz4::lz4 not LZ4::lz4
+  if(NOT TARGET LZ4::lz4 AND TARGET lz4::lz4)
+    add_library(LZ4::lz4 ALIAS lz4::lz4)
+  endif()
   return()
 endif()
 
@@ -89,9 +93,9 @@ endif()
 find_package_handle_standard_args(lz4Alt REQUIRED_VARS LZ4_LIB LZ4_INCLUDE_DIR)
 
 if(lz4Alt_FOUND)
-  if(NOT TARGET lz4::lz4)
-    add_library(lz4::lz4 UNKNOWN IMPORTED)
-    set_target_properties(lz4::lz4
+  if(NOT TARGET LZ4::lz4)
+    add_library(LZ4::lz4 UNKNOWN IMPORTED)
+    set_target_properties(LZ4::lz4
                           PROPERTIES IMPORTED_LOCATION "${LZ4_LIB}"
                                      INTERFACE_INCLUDE_DIRECTORIES "${LZ4_INCLUDE_DIR}")
   endif()
diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake
index e51b2b44bf..ad8351f9cc 100644
--- a/cpp/cmake_modules/ThirdpartyToolchain.cmake
+++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake
@@ -2336,14 +2336,14 @@ macro(build_lz4)
                       BUILD_BYPRODUCTS ${LZ4_STATIC_LIB})
 
   file(MAKE_DIRECTORY "${LZ4_PREFIX}/include")
-  add_library(lz4::lz4 STATIC IMPORTED)
-  set_target_properties(lz4::lz4
+  add_library(LZ4::lz4 STATIC IMPORTED)
+  set_target_properties(LZ4::lz4
                         PROPERTIES IMPORTED_LOCATION "${LZ4_STATIC_LIB}"
                                    INTERFACE_INCLUDE_DIRECTORIES "${LZ4_PREFIX}/include")
   add_dependencies(toolchain lz4_ep)
-  add_dependencies(lz4::lz4 lz4_ep)
+  add_dependencies(LZ4::lz4 lz4_ep)
 
-  list(APPEND ARROW_BUNDLED_STATIC_LIBS lz4::lz4)
+  list(APPEND ARROW_BUNDLED_STATIC_LIBS LZ4::lz4)
 endmacro()
 
 if(ARROW_WITH_LZ4)
@@ -4278,7 +4278,7 @@ macro(build_orc)
                       INTERFACE_INCLUDE_DIRECTORIES)
   get_filename_component(ORC_SNAPPY_ROOT "${ORC_SNAPPY_INCLUDE_DIR}" DIRECTORY)
 
-  get_target_property(ORC_LZ4_ROOT lz4::lz4 INTERFACE_INCLUDE_DIRECTORIES)
+  get_target_property(ORC_LZ4_ROOT LZ4::lz4 INTERFACE_INCLUDE_DIRECTORIES)
   get_filename_component(ORC_LZ4_ROOT "${ORC_LZ4_ROOT}" DIRECTORY)
 
   # Weirdly passing in PROTOBUF_LIBRARY for PROTOC_LIBRARY still results in ORC finding
@@ -4322,7 +4322,7 @@ macro(build_orc)
 
   set(ORC_VENDORED 1)
   add_dependencies(orc_ep ZLIB::ZLIB)
-  add_dependencies(orc_ep lz4::lz4)
+  add_dependencies(orc_ep LZ4::lz4)
   add_dependencies(orc_ep ${Snappy_TARGET})
   add_dependencies(orc_ep ${ARROW_PROTOBUF_LIBPROTOBUF})
 
diff --git a/cpp/src/arrow/adapters/orc/CMakeLists.txt b/cpp/src/arrow/adapters/orc/CMakeLists.txt
index d7cc6524bc..6b2536bb55 100644
--- a/cpp/src/arrow/adapters/orc/CMakeLists.txt
+++ b/cpp/src/arrow/adapters/orc/CMakeLists.txt
@@ -30,7 +30,7 @@ set(ORC_MIN_TEST_LIBS
     GTest::gtest_main
     GTest::gtest
     ${Snappy_TARGET}
-    lz4::lz4
+    LZ4::lz4
     ZLIB::ZLIB)
 
 if(ARROW_BUILD_STATIC)