Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARROW-17367: [C++] Fix the LZ4's CMake target name #13831

Merged
merged 1 commit into from
Aug 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
10 changes: 7 additions & 3 deletions cpp/cmake_modules/Findlz4Alt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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()
Expand Down
12 changes: 6 additions & 6 deletions cpp/cmake_modules/ThirdpartyToolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2345,14 +2345,14 @@ macro(build_lz4)
BUILD_BYPRODUCTS ${LZ4_STATIC_LIB} ${LZ4_BUILD_COMMAND})

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)
Expand Down Expand Up @@ -4286,7 +4286,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
Expand Down Expand Up @@ -4330,7 +4330,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})

Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/adapters/orc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down