|
| 1 | +# Licensed to the Apache Software Foundation (ASF) under one |
| 2 | +# or more contributor license agreements. See the NOTICE file |
| 3 | +# distributed with this work for additional information |
| 4 | +# regarding copyright ownership. The ASF licenses this file |
| 5 | +# to you under the Apache License, Version 2.0 (the |
| 6 | +# "License"); you may not use this file except in compliance |
| 7 | +# with the License. You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, |
| 12 | +# software distributed under the License is distributed on an |
| 13 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +# KIND, either express or implied. See the License for the |
| 15 | +# specific language governing permissions and limitations |
| 16 | +# under the License. |
| 17 | + |
| 18 | +diff --git a/cmake_modules/ThirdpartyToolchain.cmake b/cmake_modules/ThirdpartyToolchain.cmake |
| 19 | +index c03afa8f29..e8cfb85aa1 100644 |
| 20 | +--- a/cmake_modules/ThirdpartyToolchain.cmake |
| 21 | ++++ b/cmake_modules/ThirdpartyToolchain.cmake |
| 22 | +@@ -172,6 +172,12 @@ elseif (ORC_PACKAGE_KIND STREQUAL "vcpkg") |
| 23 | + list (APPEND ORC_SYSTEM_DEPENDENCIES Protobuf) |
| 24 | + list (APPEND ORC_INSTALL_INTERFACE_TARGETS "$<INSTALL_INTERFACE:protobuf::libprotobuf>") |
| 25 | + set (PROTOBUF_EXECUTABLE protobuf::protoc) |
| 26 | ++elseif (TARGET ${ARROW_PROTOBUF_LIBPROTOBUF}) |
| 27 | ++ # Used by Apache Arrow only, remove this once Arrow leverages FetchContent for Protobuf |
| 28 | ++ add_library (orc_protobuf INTERFACE IMPORTED) |
| 29 | ++ target_link_libraries(orc_protobuf INTERFACE ${ARROW_PROTOBUF_LIBPROTOBUF}) |
| 30 | ++ set (PROTOBUF_EXECUTABLE ${ARROW_PROTOBUF_PROTOC}) |
| 31 | ++ message(STATUS "Using existing ${ARROW_PROTOBUF_LIBPROTOBUF}") |
| 32 | + elseif (NOT "${PROTOBUF_HOME}" STREQUAL "") |
| 33 | + find_package (ProtobufAlt REQUIRED) |
| 34 | + |
| 35 | +@@ -181,12 +187,6 @@ elseif (NOT "${PROTOBUF_HOME}" STREQUAL "") |
| 36 | + orc_add_resolved_library (orc_protobuf ${PROTOBUF_LIBRARY} ${PROTOBUF_INCLUDE_DIR}) |
| 37 | + endif () |
| 38 | + |
| 39 | +- if (ORC_PREFER_STATIC_PROTOBUF AND PROTOC_STATIC_LIB) |
| 40 | +- orc_add_resolved_library (orc_protoc ${PROTOC_STATIC_LIB} ${PROTOBUF_INCLUDE_DIR}) |
| 41 | +- else () |
| 42 | +- orc_add_resolved_library (orc_protoc ${PROTOC_LIBRARY} ${PROTOBUF_INCLUDE_DIR}) |
| 43 | +- endif () |
| 44 | +- |
| 45 | + list (APPEND ORC_SYSTEM_DEPENDENCIES ProtobufAlt) |
| 46 | + list (APPEND ORC_INSTALL_INTERFACE_TARGETS "$<INSTALL_INTERFACE:protobuf::libprotobuf>") |
| 47 | + orc_provide_find_module (ProtobufAlt) |
| 48 | +@@ -245,9 +245,7 @@ else () |
| 49 | + |
| 50 | + add_library(orc_protobuf INTERFACE IMPORTED) |
| 51 | + target_link_libraries(orc_protobuf INTERFACE protobuf::libprotobuf) |
| 52 | +- if(NOT PROTOBUF_EXECUTABLE) |
| 53 | +- set(PROTOBUF_EXECUTABLE protobuf::protoc) |
| 54 | +- endif() |
| 55 | ++ set(PROTOBUF_EXECUTABLE protobuf::protoc) |
| 56 | + endblock() |
| 57 | + endif () |
| 58 | + |
| 59 | +@@ -277,6 +275,16 @@ elseif (NOT "${SNAPPY_HOME}" STREQUAL "") |
| 60 | + list (APPEND ORC_SYSTEM_DEPENDENCIES SnappyAlt) |
| 61 | + list (APPEND ORC_INSTALL_INTERFACE_TARGETS "$<INSTALL_INTERFACE:Snappy::snappy>") |
| 62 | + orc_provide_find_module (SnappyAlt) |
| 63 | ++elseif (TARGET Snappy::snappy) |
| 64 | ++ # Used by Apache Arrow only, remove this once Arrow leverages FetchContent for Snappy |
| 65 | ++ add_library (orc_snappy INTERFACE IMPORTED) |
| 66 | ++ target_link_libraries(orc_snappy INTERFACE Snappy::snappy) |
| 67 | ++ message(STATUS "Using existing Snappy::snappy") |
| 68 | ++elseif (TARGET Snappy::snappy-static) |
| 69 | ++ # Used by Apache Arrow only, remove this once Arrow leverages FetchContent for Snappy |
| 70 | ++ add_library (orc_snappy INTERFACE IMPORTED) |
| 71 | ++ target_link_libraries(orc_snappy INTERFACE Snappy::snappy-static) |
| 72 | ++ message(STATUS "Using existing Snappy::snappy-static") |
| 73 | + else () |
| 74 | + block(PROPAGATE ORC_SYSTEM_DEPENDENCIES ORC_INSTALL_INTERFACE_TARGETS) |
| 75 | + prepare_fetchcontent() |
| 76 | +@@ -359,6 +367,11 @@ elseif (NOT "${ZLIB_HOME}" STREQUAL "") |
| 77 | + list (APPEND ORC_SYSTEM_DEPENDENCIES ZLIBAlt) |
| 78 | + list (APPEND ORC_INSTALL_INTERFACE_TARGETS "$<INSTALL_INTERFACE:ZLIB::ZLIB>") |
| 79 | + orc_provide_find_module (ZLIBAlt) |
| 80 | ++elseif (TARGET ZLIB::ZLIB) |
| 81 | ++ # Used by Apache Arrow only, remove this once Arrow leverages FetchContent for ZLIB |
| 82 | ++ add_library (orc_zlib INTERFACE IMPORTED) |
| 83 | ++ target_link_libraries(orc_zlib INTERFACE ZLIB::ZLIB) |
| 84 | ++ message(STATUS "Using existing ZLIB::ZLIB") |
| 85 | + else () |
| 86 | + block(PROPAGATE ORC_SYSTEM_DEPENDENCIES ORC_INSTALL_INTERFACE_TARGETS ZLIB_LIBRARIES ZLIB_INCLUDE_DIRS) |
| 87 | + prepare_fetchcontent() |
| 88 | +@@ -450,6 +463,16 @@ elseif (NOT "${ZSTD_HOME}" STREQUAL "") |
| 89 | + endif () |
| 90 | + list (APPEND ORC_SYSTEM_DEPENDENCIES ZSTDAlt) |
| 91 | + orc_provide_find_module (ZSTDAlt) |
| 92 | ++elseif (TARGET zstd::libzstd_shared) |
| 93 | ++ # Used by Apache Arrow only, remove this once Arrow leverages FetchContent for zstd |
| 94 | ++ add_library (orc_zstd INTERFACE IMPORTED) |
| 95 | ++ target_link_libraries(orc_zstd INTERFACE zstd::libzstd_shared) |
| 96 | ++ message(STATUS "Using existing zstd::libzstd_shared") |
| 97 | ++elseif (TARGET zstd::libzstd_static) |
| 98 | ++ # Used by Apache Arrow only, remove this once Arrow leverages FetchContent for zstd |
| 99 | ++ add_library (orc_zstd INTERFACE IMPORTED) |
| 100 | ++ target_link_libraries(orc_zstd INTERFACE zstd::libzstd_static) |
| 101 | ++ message(STATUS "Using existing zstd::libzstd_static") |
| 102 | + else () |
| 103 | + block(PROPAGATE ORC_SYSTEM_DEPENDENCIES ORC_INSTALL_INTERFACE_TARGETS) |
| 104 | + prepare_fetchcontent() |
0 commit comments