Skip to content

Commit 6aea9ed

Browse files
committed
ORC-1846: [C++] Fix imported libraries in the Conan build
### What changes were proposed in this pull request? Fix all imported libraries of thirdparty dependencies to build in Conan. ### Why are the changes needed? Upgrading the C++ ORC 2.1.0 in Conan will fail due to the CMake refactoring. See conan-io/conan-center-index#26426 ### How was this patch tested? See CIs from Conan: https://github.com/conan-io/conan-center-index/pull/26426/checks?check_run_id=35916226382 ### Was this patch authored or co-authored using generative AI tooling? No. Closes #2121 from wgtmac/fix_conan. Authored-by: Gang Wu <[email protected]> Signed-off-by: Gang Wu <[email protected]> (cherry picked from commit 09b0650) Signed-off-by: Gang Wu <[email protected]>
1 parent 3f6d5de commit 6aea9ed

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

cmake_modules/ThirdpartyToolchain.cmake

+18-7
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ ExternalProject_Add (orc-format_ep
156156
# Snappy
157157
if (ORC_PACKAGE_KIND STREQUAL "conan")
158158
find_package (Snappy REQUIRED CONFIG)
159-
orc_add_resolved_library (orc_snappy ${Snappy_LIBRARIES} ${Snappy_INCLUDE_DIR})
159+
add_library (orc_snappy INTERFACE)
160+
target_link_libraries(orc_snappy INTERFACE Snappy::snappy)
160161
list (APPEND ORC_SYSTEM_DEPENDENCIES Snappy)
161162
list (APPEND ORC_INSTALL_INTERFACE_TARGETS "$<INSTALL_INTERFACE:Snappy::snappy>")
162163
elseif (ORC_PACKAGE_KIND STREQUAL "vcpkg")
@@ -207,7 +208,8 @@ add_library (orc::snappy ALIAS orc_snappy)
207208

208209
if (ORC_PACKAGE_KIND STREQUAL "conan")
209210
find_package (ZLIB REQUIRED CONFIG)
210-
orc_add_resolved_library (orc_zlib ${ZLIB_LIBRARIES} ${ZLIB_INCLUDE_DIR})
211+
add_library (orc_zlib INTERFACE)
212+
target_link_libraries(orc_zlib INTERFACE ZLIB::ZLIB)
211213
list (APPEND ORC_SYSTEM_DEPENDENCIES ZLIB)
212214
list (APPEND ORC_INSTALL_INTERFACE_TARGETS "$<INSTALL_INTERFACE:ZLIB::ZLIB>")
213215
elseif (ORC_PACKAGE_KIND STREQUAL "vcpkg")
@@ -265,7 +267,11 @@ add_library (orc::zlib ALIAS orc_zlib)
265267

266268
if (ORC_PACKAGE_KIND STREQUAL "conan")
267269
find_package (ZSTD REQUIRED CONFIG)
268-
orc_add_resolved_library (orc_zstd ${zstd_LIBRARIES} ${zstd_INCLUDE_DIR})
270+
add_library (orc_zstd INTERFACE)
271+
target_link_libraries (orc_zstd INTERFACE
272+
$<TARGET_NAME_IF_EXISTS:zstd::libzstd_static>
273+
$<TARGET_NAME_IF_EXISTS:zstd::libzstd_shared>
274+
)
269275
list (APPEND ORC_SYSTEM_DEPENDENCIES ZSTD)
270276
list (APPEND ORC_INSTALL_INTERFACE_TARGETS "$<INSTALL_INTERFACE:$<IF:$<TARGET_EXISTS:zstd::libzstd_shared>,zstd::libzstd_shared,zstd::libzstd_static>>")
271277
elseif (ORC_PACKAGE_KIND STREQUAL "vcpkg")
@@ -330,9 +336,13 @@ add_library (orc::zstd ALIAS orc_zstd)
330336
# LZ4
331337
if (ORC_PACKAGE_KIND STREQUAL "conan")
332338
find_package (LZ4 REQUIRED CONFIG)
333-
orc_add_resolved_library (orc_lz4 ${lz4_LIBRARIES} ${lz4_INCLUDE_DIR})
339+
add_library (orc_lz4 INTERFACE)
340+
target_link_libraries (orc_lz4 INTERFACE
341+
$<TARGET_NAME_IF_EXISTS:LZ4::lz4_shared>
342+
$<TARGET_NAME_IF_EXISTS:LZ4::lz4_static>
343+
)
334344
list (APPEND ORC_SYSTEM_DEPENDENCIES LZ4)
335-
list (APPEND ORC_INSTALL_INTERFACE_TARGETS "$<INSTALL_INTERFACE:LZ4::lz4>")
345+
list (APPEND ORC_INSTALL_INTERFACE_TARGETS "$<INSTALL_INTERFACE:$<IF:$<TARGET_EXISTS:LZ4::lz4_shared>,LZ4::lz4_shared,LZ4::lz4_static>>")
336346
elseif (ORC_PACKAGE_KIND STREQUAL "vcpkg")
337347
find_package(lz4 CONFIG REQUIRED)
338348
add_library (orc_lz4 INTERFACE IMPORTED)
@@ -491,9 +501,10 @@ endif ()
491501

492502
if (ORC_PACKAGE_KIND STREQUAL "conan")
493503
find_package (Protobuf REQUIRED CONFIG)
494-
orc_add_resolved_library (orc_protobuf ${protobuf_LIBRARIES} ${protobuf_INCLUDE_DIR})
504+
add_library (orc_protobuf INTERFACE)
505+
target_link_libraries(orc_protobuf INTERFACE protobuf::protobuf)
495506
list (APPEND ORC_SYSTEM_DEPENDENCIES Protobuf)
496-
list (APPEND ORC_INSTALL_INTERFACE_TARGETS "$<INSTALL_INTERFACE:protobuf::libprotobuf>")
507+
list (APPEND ORC_INSTALL_INTERFACE_TARGETS "$<INSTALL_INTERFACE:protobuf::protobuf>")
497508
elseif (ORC_PACKAGE_KIND STREQUAL "vcpkg")
498509
find_package(Protobuf CONFIG REQUIRED)
499510
add_library (orc_protobuf INTERFACE IMPORTED)

0 commit comments

Comments
 (0)