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

gangwu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/orc.git


The following commit(s) were added to refs/heads/main by this push:
     new 23efdabc9 ORC-1622: [C++] Support conan packaging
23efdabc9 is described below

commit 23efdabc90ae85170a444933b7d1067866b8d363
Author: Gang Wu <[email protected]>
AuthorDate: Thu Feb 22 23:11:04 2024 +0800

    ORC-1622: [C++] Support conan packaging
    
    ### What changes were proposed in this pull request?
    Add conan recipe for the C++ library. The latest release of supported 
versions are added by default.
    
    ### Why are the changes needed?
    Conan is a popular C++ package manager: https://docs.conan.io/2/index.html. 
It would be good to support conan recipe on our end.
    
    ### How was this patch tested?
    Test it locally using conan command.
    
    ### Was this patch authored or co-authored using generative AI tooling?
    No
    
    Closes #1805 from wgtmac/conan.
    
    Authored-by: Gang Wu <[email protected]>
    Signed-off-by: Gang Wu <[email protected]>
---
 CMakeLists.txt                                     |   4 +
 cmake_modules/ThirdpartyToolchain.cmake            |  59 +++++--
 conan/conandata.yml                                |  34 ++++
 conan/conanfile.py                                 | 120 ++++++++++++++
 .../patches/0001-thirdparty-toolchain-1.7.x.patch  | 184 +++++++++++++++++++++
 .../patches/0001-thirdparty-toolchain-1.8.x.patch  | 183 ++++++++++++++++++++
 .../patches/0001-thirdparty-toolchain-1.9.x.patch  | 182 ++++++++++++++++++++
 conan/test_package/CMakeLists.txt                  |  24 +++
 conan/test_package/conanfile.py                    |  42 +++++
 conan/test_package/src/example.cpp                 |  26 +++
 10 files changed, 843 insertions(+), 15 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c68b92820..7fc18cea1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -76,6 +76,10 @@ option(BUILD_ENABLE_AVX512
     "Enable build with AVX512 at compile time"
     OFF)
 
+option(ORC_PACKAGE_KIND
+    "Arbitrary string that identifies the kind of package"
+    "")
+
 # Make sure that a build type is selected
 if (NOT CMAKE_BUILD_TYPE)
   message(STATUS "No build type selected, default to ReleaseWithDebugInfo")
diff --git a/cmake_modules/ThirdpartyToolchain.cmake 
b/cmake_modules/ThirdpartyToolchain.cmake
index 726a2cb92..1e7ef939a 100644
--- a/cmake_modules/ThirdpartyToolchain.cmake
+++ b/cmake_modules/ThirdpartyToolchain.cmake
@@ -83,7 +83,7 @@ ExternalProject_Add (orc-format_ep
 # ----------------------------------------------------------------------
 # Snappy
 
-if (NOT "${SNAPPY_HOME}" STREQUAL "")
+if (NOT "${SNAPPY_HOME}" STREQUAL "" OR ORC_PACKAGE_KIND STREQUAL "conan")
   find_package (Snappy REQUIRED)
   set(SNAPPY_VENDORED FALSE)
 else ()
@@ -109,12 +109,18 @@ endif ()
 
 add_library (orc_snappy INTERFACE)
 add_library (orc::snappy ALIAS orc_snappy)
-if (ORC_PREFER_STATIC_SNAPPY AND ${SNAPPY_STATIC_LIB})
+if (ORC_PACKAGE_KIND STREQUAL "conan")
+  target_link_libraries(orc_snappy INTERFACE ${Snappy_LIBRARIES})
+elseif (ORC_PREFER_STATIC_SNAPPY AND ${SNAPPY_STATIC_LIB})
   target_link_libraries(orc_snappy INTERFACE ${SNAPPY_STATIC_LIB})
 else ()
   target_link_libraries(orc_snappy INTERFACE ${SNAPPY_LIBRARY})
 endif ()
-target_include_directories (orc_snappy SYSTEM INTERFACE ${SNAPPY_INCLUDE_DIR})
+if (ORC_PACKAGE_KIND STREQUAL "conan")
+  target_include_directories (orc_snappy SYSTEM INTERFACE 
${Snappy_INCLUDE_DIR})
+else()
+  target_include_directories (orc_snappy SYSTEM INTERFACE 
${SNAPPY_INCLUDE_DIR})
+endif ()
 
 if (SNAPPY_VENDORED)
   add_dependencies (orc_snappy snappy_ep)
@@ -127,7 +133,7 @@ endif ()
 # ----------------------------------------------------------------------
 # ZLIB
 
-if (NOT "${ZLIB_HOME}" STREQUAL "")
+if (NOT "${ZLIB_HOME}" STREQUAL "" OR ORC_PACKAGE_KIND STREQUAL "conan")
   find_package (ZLIB REQUIRED)
   set(ZLIB_VENDORED FALSE)
 else ()
@@ -161,7 +167,9 @@ endif ()
 
 add_library (orc_zlib INTERFACE)
 add_library (orc::zlib ALIAS orc_zlib)
-if (ORC_PREFER_STATIC_ZLIB AND ${ZLIB_STATIC_LIB})
+if (ORC_PACKAGE_KIND STREQUAL "conan")
+  target_link_libraries (orc_zlib INTERFACE ${ZLIB_LIBRARIES})
+elseif (ORC_PREFER_STATIC_ZLIB AND ${ZLIB_STATIC_LIB})
   target_link_libraries (orc_zlib INTERFACE ${ZLIB_STATIC_LIB})
 else ()
   target_link_libraries (orc_zlib INTERFACE ${ZLIB_LIBRARY})
@@ -179,7 +187,7 @@ endif ()
 # ----------------------------------------------------------------------
 # Zstd
 
-if (NOT "${ZSTD_HOME}" STREQUAL "")
+if (NOT "${ZSTD_HOME}" STREQUAL "" OR ORC_PACKAGE_KIND STREQUAL "conan")
   find_package (ZSTD REQUIRED)
   set(ZSTD_VENDORED FALSE)
 else ()
@@ -220,12 +228,18 @@ endif ()
 
 add_library (orc_zstd INTERFACE)
 add_library (orc::zstd ALIAS orc_zstd)
-if (ORC_PREFER_STATIC_ZSTD AND ${ZSTD_STATIC_LIB})
+if (ORC_PACKAGE_KIND STREQUAL "conan")
+  target_link_libraries (orc_zstd INTERFACE ${zstd_LIBRARIES})
+elseif (ORC_PREFER_STATIC_ZSTD AND ${ZSTD_STATIC_LIB})
   target_link_libraries (orc_zstd INTERFACE ${ZSTD_STATIC_LIB})
 else ()
   target_link_libraries (orc_zstd INTERFACE ${ZSTD_LIBRARY})
 endif ()
-target_include_directories (orc_zstd SYSTEM INTERFACE ${ZSTD_INCLUDE_DIR})
+if (ORC_PACKAGE_KIND STREQUAL "conan")
+  target_include_directories (orc_zstd SYSTEM INTERFACE ${zstd_INCLUDE_DIR})
+else()
+  target_include_directories (orc_zstd SYSTEM INTERFACE ${ZSTD_INCLUDE_DIR})
+endif ()
 
 if (ZSTD_VENDORED)
   add_dependencies (orc_zstd zstd_ep)
@@ -238,7 +252,7 @@ endif ()
 # ----------------------------------------------------------------------
 # LZ4
 
-if (NOT "${LZ4_HOME}" STREQUAL "")
+if (NOT "${LZ4_HOME}" STREQUAL "" OR ORC_PACKAGE_KIND STREQUAL "conan")
   find_package (LZ4 REQUIRED)
   set(LZ4_VENDORED FALSE)
 else ()
@@ -272,12 +286,18 @@ endif ()
 
 add_library (orc_lz4 INTERFACE)
 add_library (orc::lz4 ALIAS orc_lz4)
-if (ORC_PREFER_STATIC_LZ4 AND ${LZ4_STATIC_LIB})
+if (ORC_PACKAGE_KIND STREQUAL "conan")
+  target_link_libraries (orc_lz4 INTERFACE ${lz4_LIBRARIES})
+elseif (ORC_PREFER_STATIC_LZ4 AND ${LZ4_STATIC_LIB})
   target_link_libraries (orc_lz4 INTERFACE ${LZ4_STATIC_LIB})
 else ()
   target_link_libraries (orc_lz4 INTERFACE ${LZ4_LIBRARY})
 endif ()
-target_include_directories (orc_lz4 SYSTEM INTERFACE ${LZ4_INCLUDE_DIR})
+if (ORC_PACKAGE_KIND STREQUAL "conan")
+  target_include_directories (orc_lz4 SYSTEM INTERFACE ${lz4_INCLUDE_DIR})
+else()
+  target_include_directories (orc_lz4 SYSTEM INTERFACE ${LZ4_INCLUDE_DIR})
+endif ()
 
 if (LZ4_VENDORED)
   add_dependencies (orc_lz4 lz4_ep)
@@ -393,7 +413,7 @@ endif ()
 # ----------------------------------------------------------------------
 # Protobuf
 
-if (NOT "${PROTOBUF_HOME}" STREQUAL "")
+if (NOT "${PROTOBUF_HOME}" STREQUAL "" OR ORC_PACKAGE_KIND STREQUAL "conan")
   find_package (Protobuf REQUIRED)
   set(PROTOBUF_VENDORED FALSE)
 else ()
@@ -442,14 +462,23 @@ add_library (orc::protobuf ALIAS orc_protobuf)
 add_library (orc_protoc INTERFACE)
 add_library (orc::protoc ALIAS orc_protoc)
 
-if (ORC_PREFER_STATIC_PROTOBUF AND ${PROTOBUF_STATIC_LIB})
+if (ORC_PACKAGE_KIND STREQUAL "conan")
+  target_link_libraries (orc_protobuf INTERFACE ${protobuf_LIBRARIES})
+elseif (ORC_PREFER_STATIC_PROTOBUF AND ${PROTOBUF_STATIC_LIB})
   target_link_libraries (orc_protobuf INTERFACE ${PROTOBUF_STATIC_LIB})
 else ()
   target_link_libraries (orc_protobuf INTERFACE ${PROTOBUF_LIBRARY})
 endif()
-target_include_directories (orc_protobuf SYSTEM INTERFACE 
${PROTOBUF_INCLUDE_DIR})
+if (ORC_PACKAGE_KIND STREQUAL "conan")
+  target_include_directories (orc_protobuf SYSTEM INTERFACE 
${protobuf_INCLUDE_DIR})
+else ()
+  target_include_directories (orc_protobuf SYSTEM INTERFACE 
${PROTOBUF_INCLUDE_DIR})
+endif ()
 
-if (ORC_PREFER_STATIC_PROTOBUF AND ${PROTOC_STATIC_LIB})
+if (ORC_PACKAGE_KIND STREQUAL "conan")
+  cmake_path(GET protobuf_INCLUDE_DIR PARENT_PATH PROTOBUF_HOME)
+  set(PROTOBUF_EXECUTABLE ${PROTOBUF_HOME}/bin/protoc)
+elseif (ORC_PREFER_STATIC_PROTOBUF AND ${PROTOC_STATIC_LIB})
   target_link_libraries (orc_protoc INTERFACE ${PROTOC_STATIC_LIB})
 else ()
   target_link_libraries (orc_protoc INTERFACE ${PROTOC_LIBRARY})
diff --git a/conan/conandata.yml b/conan/conandata.yml
new file mode 100644
index 000000000..c0e126fc2
--- /dev/null
+++ b/conan/conandata.yml
@@ -0,0 +1,34 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+sources:
+  "1.9.2":
+    url: "https://dlcdn.apache.org/orc/orc-1.9.2/orc-1.9.2.tar.gz";
+    sha256: "7f46f2c184ecefd6791f1a53fb062286818bd8710c3f08b94dd3cac365e240ee"
+  "1.8.6":
+    url: "https://dlcdn.apache.org/orc/orc-1.8.6/orc-1.8.6.tar.gz";
+    sha256: "5675b18118df4dd7f86cc6ba859ed75b425ea1b7ddff805e1d671a17fd57d7f7"
+  "1.7.10":
+    url: "https://dlcdn.apache.org/orc/orc-1.7.10/orc-1.7.10.tar.gz";
+    sha256: "85aef9368dc9bcdffaaf10010b66dfe053ce22f30b64854f63852248164686a3"
+patches:
+  "1.9.2":
+    - patch_file: "patches/0001-thirdparty-toolchain-1.9.x.patch"
+  "1.8.6":
+    - patch_file: "patches/0001-thirdparty-toolchain-1.8.x.patch"
+  "1.7.10":
+    - patch_file: "patches/0001-thirdparty-toolchain-1.7.x.patch"
diff --git a/conan/conanfile.py b/conan/conanfile.py
new file mode 100644
index 000000000..18f911088
--- /dev/null
+++ b/conan/conanfile.py
@@ -0,0 +1,120 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from conan import ConanFile
+from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps
+from conan.tools.files import apply_conandata_patches, 
export_conandata_patches, get, copy, rmdir
+from conan.tools.scm import Version
+
+import os
+
+required_conan_version = ">=1.54.0"
+
+class OrcRecipe(ConanFile):
+    name = "orc"
+    description = "The smallest, fastest columnar storage for Hadoop workloads"
+    license = "Apache-2.0"
+    url = "https://github.com/conan-io/conan-center-index";
+    homepage = "https://orc.apache.org/";
+    topics = ("orc", "columnar-storage", "hadoop")
+    settings = "os", "compiler", "build_type", "arch"
+    options = {
+        "shared": [False],
+        "fPIC": [True, False],
+    }
+    default_options = {
+        "shared": False,
+        "fPIC": True,
+    }
+
+    @property
+    def _minimum_cpp_standard(self):
+        return 11 if Version(self.version) < "1.9.0" else 17
+
+    def source(self):
+        if not self.version in self.conan_data.get("sources", {}):
+            import shutil
+            top_level = os.environ.get("ORC_HOME")
+            shutil.copytree(os.path.join(top_level, "c++"),
+                            os.path.join(self.source_folder, "c++"))
+            shutil.copytree(os.path.join(top_level, "cmake_modules"),
+                            os.path.join(self.source_folder, "cmake_modules"))
+            top_level_files = [
+                "CMakeLists.txt",
+                "LICENSE",
+                "NOTICE",
+            ]
+            for top_level_file in top_level_files:
+                shutil.copy(os.path.join(top_level, top_level_file),
+                            self.source_folder)
+            return
+        get(self, **self.conan_data["sources"][self.version], strip_root=True)
+
+    def config_options(self):
+        if self.settings.os == "Windows":
+            self.options.rm_safe("fPIC")
+
+    def configure(self):
+        if self.options.shared:
+            self.options.rm_safe("fPIC")
+
+    def export_sources(self):
+        export_conandata_patches(self)
+
+    def requirements(self):
+        self.requires("protobuf/3.19.4")
+        self.requires("zlib/1.3")
+        self.requires("snappy/1.1.9")
+        self.requires("lz4/1.9.4")
+        self.requires("zstd/1.5.5")
+
+    def layout(self):
+        cmake_layout(self, src_folder="src", build_folder="build")
+
+    def generate(self):
+        deps = CMakeDeps(self)
+        deps.generate()
+        tc = CMakeToolchain(self)
+        tc.variables["ORC_PACKAGE_KIND"] = "conan"
+        tc.variables["BUILD_JAVA"] = "OFF"
+        tc.variables["BUILD_CPP_TESTS"] = "OFF"
+        tc.variables["BUILD_TOOLS"] = "OFF"
+        tc.variables["BUILD_LIBHDFSPP"] = "OFF"
+        tc.variables["BUILD_POSITION_INDEPENDENT_LIB"] = 
bool(self.options.get_safe("fPIC", True))
+        tc.variables["INSTALL_VENDORED_LIBS"] = "OFF"
+        tc.generate()
+
+    def build(self):
+        apply_conandata_patches(self)
+        cmake = CMake(self)
+        cmake.configure()
+        cmake.build()
+
+    def package(self):
+        copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, 
"licenses"), src=self.source_folder)
+        copy(self, pattern="NOTICE", dst=os.path.join(self.package_folder, 
"licenses"), src=self.source_folder)
+        cmake = CMake(self)
+        cmake.install()
+        rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))
+        rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
+        rmdir(self, os.path.join(self.package_folder, "share"))
+
+    def package_info(self):
+        self.cpp_info.set_property("cmake_file_name", "orc")
+        self.cpp_info.set_property("cmake_target_name", "orc::orc")
+        self.cpp_info.set_property("pkg_config_name", "liborc")
+        self.cpp_info.libs = ["orc"]
diff --git a/conan/patches/0001-thirdparty-toolchain-1.7.x.patch 
b/conan/patches/0001-thirdparty-toolchain-1.7.x.patch
new file mode 100644
index 000000000..2f64f3b79
--- /dev/null
+++ b/conan/patches/0001-thirdparty-toolchain-1.7.x.patch
@@ -0,0 +1,184 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 93bd1035b..57c83b961 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -68,6 +68,10 @@ option(BUILD_POSITION_INDEPENDENT_LIB
+     "Compile static libraries with position independent code"
+     OFF)
+ 
++option(ORC_PACKAGE_KIND
++    "Arbitrary string that identifies the kind of package"
++    "")
++
+ # Make sure that a build type is selected
+ if (NOT CMAKE_BUILD_TYPE)
+   message(STATUS "No build type selected, default to ReleaseWithDebugInfo")
+
+diff --git a/cmake_modules/ThirdpartyToolchain.cmake 
b/cmake_modules/ThirdpartyToolchain.cmake
+index a394d7315..3cd3e9faa 100644
+--- a/cmake_modules/ThirdpartyToolchain.cmake
++++ b/cmake_modules/ThirdpartyToolchain.cmake
+@@ -71,7 +71,7 @@ endif ()
+ # ----------------------------------------------------------------------
+ # Snappy
+ 
+-if (NOT "${SNAPPY_HOME}" STREQUAL "")
++if (NOT "${SNAPPY_HOME}" STREQUAL "" OR ORC_PACKAGE_KIND STREQUAL "conan")
+   find_package (Snappy REQUIRED)
+   set(SNAPPY_VENDORED FALSE)
+ else ()
+@@ -97,12 +97,18 @@ endif ()
+ 
+ add_library (orc_snappy INTERFACE)
+ add_library (orc::snappy ALIAS orc_snappy)
+-if (ORC_PREFER_STATIC_SNAPPY AND ${SNAPPY_STATIC_LIB})
++if (ORC_PACKAGE_KIND STREQUAL "conan")
++  target_link_libraries(orc_snappy INTERFACE ${Snappy_LIBRARIES})
++elseif (ORC_PREFER_STATIC_SNAPPY AND ${SNAPPY_STATIC_LIB})
+   target_link_libraries(orc_snappy INTERFACE ${SNAPPY_STATIC_LIB})
+ else ()
+   target_link_libraries(orc_snappy INTERFACE ${SNAPPY_LIBRARY})
+ endif ()
+-target_include_directories (orc_snappy SYSTEM INTERFACE ${SNAPPY_INCLUDE_DIR})
++if (ORC_PACKAGE_KIND STREQUAL "conan")
++  target_include_directories (orc_snappy SYSTEM INTERFACE 
${Snappy_INCLUDE_DIR})
++else()
++  target_include_directories (orc_snappy SYSTEM INTERFACE 
${SNAPPY_INCLUDE_DIR})
++endif ()
+ 
+ if (SNAPPY_VENDORED)
+   add_dependencies (orc_snappy snappy_ep)
+@@ -115,7 +121,7 @@ endif ()
+ # ----------------------------------------------------------------------
+ # ZLIB
+ 
+-if (NOT "${ZLIB_HOME}" STREQUAL "")
++if (NOT "${ZLIB_HOME}" STREQUAL "" OR ORC_PACKAGE_KIND STREQUAL "conan")
+   find_package (ZLIB REQUIRED)
+   set(ZLIB_VENDORED FALSE)
+ else ()
+@@ -149,7 +155,9 @@ endif ()
+ 
+ add_library (orc_zlib INTERFACE)
+ add_library (orc::zlib ALIAS orc_zlib)
+-if (ORC_PREFER_STATIC_ZLIB AND ${ZLIB_STATIC_LIB})
++if (ORC_PACKAGE_KIND STREQUAL "conan")
++  target_link_libraries (orc_zlib INTERFACE ${ZLIB_LIBRARIES})
++elseif (ORC_PREFER_STATIC_ZLIB AND ${ZLIB_STATIC_LIB})
+   target_link_libraries (orc_zlib INTERFACE ${ZLIB_STATIC_LIB})
+ else ()
+   target_link_libraries (orc_zlib INTERFACE ${ZLIB_LIBRARY})
+@@ -167,7 +175,7 @@ endif ()
+ # ----------------------------------------------------------------------
+ # Zstd
+ 
+-if (NOT "${ZSTD_HOME}" STREQUAL "")
++if (NOT "${ZSTD_HOME}" STREQUAL "" OR ORC_PACKAGE_KIND STREQUAL "conan")
+   find_package (ZSTD REQUIRED)
+   set(ZSTD_VENDORED FALSE)
+ else ()
+@@ -208,12 +216,18 @@ endif ()
+ 
+ add_library (orc_zstd INTERFACE)
+ add_library (orc::zstd ALIAS orc_zstd)
+-if (ORC_PREFER_STATIC_ZSTD AND ${ZSTD_STATIC_LIB})
++if (ORC_PACKAGE_KIND STREQUAL "conan")
++  target_link_libraries (orc_zstd INTERFACE ${zstd_LIBRARIES})
++elseif (ORC_PREFER_STATIC_ZSTD AND ${ZSTD_STATIC_LIB})
+   target_link_libraries (orc_zstd INTERFACE ${ZSTD_STATIC_LIB})
+ else ()
+   target_link_libraries (orc_zstd INTERFACE ${ZSTD_LIBRARY})
+ endif ()
+-target_include_directories (orc_zstd SYSTEM INTERFACE ${ZSTD_INCLUDE_DIR})
++if (ORC_PACKAGE_KIND STREQUAL "conan")
++  target_include_directories (orc_zstd SYSTEM INTERFACE ${zstd_INCLUDE_DIR})
++else()
++  target_include_directories (orc_zstd SYSTEM INTERFACE ${ZSTD_INCLUDE_DIR})
++endif ()
+ 
+ if (ZSTD_VENDORED)
+   add_dependencies (orc_zstd zstd_ep)
+@@ -226,7 +240,7 @@ endif ()
+ # ----------------------------------------------------------------------
+ # LZ4
+ 
+-if (NOT "${LZ4_HOME}" STREQUAL "")
++if (NOT "${LZ4_HOME}" STREQUAL "" OR ORC_PACKAGE_KIND STREQUAL "conan")
+   find_package (LZ4 REQUIRED)
+   set(LZ4_VENDORED FALSE)
+ else ()
+@@ -260,12 +274,18 @@ endif ()
+ 
+ add_library (orc_lz4 INTERFACE)
+ add_library (orc::lz4 ALIAS orc_lz4)
+-if (ORC_PREFER_STATIC_LZ4 AND ${LZ4_STATIC_LIB})
++if (ORC_PACKAGE_KIND STREQUAL "conan")
++  target_link_libraries (orc_lz4 INTERFACE ${lz4_LIBRARIES})
++elseif (ORC_PREFER_STATIC_LZ4 AND ${LZ4_STATIC_LIB})
+   target_link_libraries (orc_lz4 INTERFACE ${LZ4_STATIC_LIB})
+ else ()
+   target_link_libraries (orc_lz4 INTERFACE ${LZ4_LIBRARY})
+ endif ()
+-target_include_directories (orc_lz4 SYSTEM INTERFACE ${LZ4_INCLUDE_DIR})
++if (ORC_PACKAGE_KIND STREQUAL "conan")
++  target_include_directories (orc_lz4 SYSTEM INTERFACE ${lz4_INCLUDE_DIR})
++else()
++  target_include_directories (orc_lz4 SYSTEM INTERFACE ${LZ4_INCLUDE_DIR})
++endif ()
+ 
+ if (LZ4_VENDORED)
+   add_dependencies (orc_lz4 lz4_ep)
+@@ -377,7 +397,7 @@ endif ()
+ # ----------------------------------------------------------------------
+ # Protobuf
+ 
+-if (NOT "${PROTOBUF_HOME}" STREQUAL "")
++if (NOT "${PROTOBUF_HOME}" STREQUAL "" OR ORC_PACKAGE_KIND STREQUAL "conan")
+   find_package (Protobuf REQUIRED)
+   set(PROTOBUF_VENDORED FALSE)
+ else ()
+@@ -426,14 +446,23 @@ add_library (orc::protobuf ALIAS orc_protobuf)
+ add_library (orc_protoc INTERFACE)
+ add_library (orc::protoc ALIAS orc_protoc)
+ 
+-if (ORC_PREFER_STATIC_PROTOBUF AND ${PROTOBUF_STATIC_LIB})
++if (ORC_PACKAGE_KIND STREQUAL "conan")
++  target_link_libraries (orc_protobuf INTERFACE ${protobuf_LIBRARIES})
++elseif (ORC_PREFER_STATIC_PROTOBUF AND ${PROTOBUF_STATIC_LIB})
+   target_link_libraries (orc_protobuf INTERFACE ${PROTOBUF_STATIC_LIB})
+ else ()
+   target_link_libraries (orc_protobuf INTERFACE ${PROTOBUF_LIBRARY})
+ endif()
+-target_include_directories (orc_protobuf SYSTEM INTERFACE 
${PROTOBUF_INCLUDE_DIR})
++if (ORC_PACKAGE_KIND STREQUAL "conan")
++  target_include_directories (orc_protobuf SYSTEM INTERFACE 
${protobuf_INCLUDE_DIR})
++else ()
++  target_include_directories (orc_protobuf SYSTEM INTERFACE 
${PROTOBUF_INCLUDE_DIR})
++endif ()
+ 
+-if (ORC_PREFER_STATIC_PROTOBUF AND ${PROTOC_STATIC_LIB})
++if (ORC_PACKAGE_KIND STREQUAL "conan")
++  cmake_path(GET protobuf_INCLUDE_DIR PARENT_PATH PROTOBUF_HOME)
++  set(PROTOBUF_EXECUTABLE ${PROTOBUF_HOME}/bin/protoc)
++elseif (ORC_PREFER_STATIC_PROTOBUF AND ${PROTOC_STATIC_LIB})
+   target_link_libraries (orc_protoc INTERFACE ${PROTOC_STATIC_LIB})
+ else ()
+   target_link_libraries (orc_protoc INTERFACE ${PROTOC_LIBRARY})
diff --git a/conan/patches/0001-thirdparty-toolchain-1.8.x.patch 
b/conan/patches/0001-thirdparty-toolchain-1.8.x.patch
new file mode 100644
index 000000000..b2157030f
--- /dev/null
+++ b/conan/patches/0001-thirdparty-toolchain-1.8.x.patch
@@ -0,0 +1,183 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index de0869dc7..df66939c4 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt 
+@@ -68,6 +68,10 @@ option(BUILD_POSITION_INDEPENDENT_LIB
+     "Compile static libraries with position independent code"
+     OFF)
+ 
++option(ORC_PACKAGE_KIND
++    "Arbitrary string that identifies the kind of package"
++    "")
++
+ # Make sure that a build type is selected
+ if (NOT CMAKE_BUILD_TYPE)
+   message(STATUS "No build type selected, default to ReleaseWithDebugInfo")
+
+diff --git a/cmake_modules/ThirdpartyToolchain.cmake 
b/cmake_modules/ThirdpartyToolchain.cmake
+index a394d7315..3cd3e9faa 100644
+--- a/cmake_modules/ThirdpartyToolchain.cmake
++++ b/cmake_modules/ThirdpartyToolchain.cmake
+@@ -71,7 +71,7 @@ endif ()
+ # ----------------------------------------------------------------------
+ # Snappy
+ 
+-if (NOT "${SNAPPY_HOME}" STREQUAL "")
++if (NOT "${SNAPPY_HOME}" STREQUAL "" OR ORC_PACKAGE_KIND STREQUAL "conan")
+   find_package (Snappy REQUIRED)
+   set(SNAPPY_VENDORED FALSE)
+ else ()
+@@ -97,12 +97,18 @@ endif ()
+ 
+ add_library (orc_snappy INTERFACE)
+ add_library (orc::snappy ALIAS orc_snappy)
+-if (ORC_PREFER_STATIC_SNAPPY AND ${SNAPPY_STATIC_LIB})
++if (ORC_PACKAGE_KIND STREQUAL "conan")
++  target_link_libraries(orc_snappy INTERFACE ${Snappy_LIBRARIES})
++elseif (ORC_PREFER_STATIC_SNAPPY AND ${SNAPPY_STATIC_LIB})
+   target_link_libraries(orc_snappy INTERFACE ${SNAPPY_STATIC_LIB})
+ else ()
+   target_link_libraries(orc_snappy INTERFACE ${SNAPPY_LIBRARY})
+ endif ()
+-target_include_directories (orc_snappy SYSTEM INTERFACE ${SNAPPY_INCLUDE_DIR})
++if (ORC_PACKAGE_KIND STREQUAL "conan")
++  target_include_directories (orc_snappy SYSTEM INTERFACE 
${Snappy_INCLUDE_DIR})
++else()
++  target_include_directories (orc_snappy SYSTEM INTERFACE 
${SNAPPY_INCLUDE_DIR})
++endif ()
+ 
+ if (SNAPPY_VENDORED)
+   add_dependencies (orc_snappy snappy_ep)
+@@ -115,7 +121,7 @@ endif ()
+ # ----------------------------------------------------------------------
+ # ZLIB
+ 
+-if (NOT "${ZLIB_HOME}" STREQUAL "")
++if (NOT "${ZLIB_HOME}" STREQUAL "" OR ORC_PACKAGE_KIND STREQUAL "conan")
+   find_package (ZLIB REQUIRED)
+   set(ZLIB_VENDORED FALSE)
+ else ()
+@@ -149,7 +155,9 @@ endif ()
+ 
+ add_library (orc_zlib INTERFACE)
+ add_library (orc::zlib ALIAS orc_zlib)
+-if (ORC_PREFER_STATIC_ZLIB AND ${ZLIB_STATIC_LIB})
++if (ORC_PACKAGE_KIND STREQUAL "conan")
++  target_link_libraries (orc_zlib INTERFACE ${ZLIB_LIBRARIES})
++elseif (ORC_PREFER_STATIC_ZLIB AND ${ZLIB_STATIC_LIB})
+   target_link_libraries (orc_zlib INTERFACE ${ZLIB_STATIC_LIB})
+ else ()
+   target_link_libraries (orc_zlib INTERFACE ${ZLIB_LIBRARY})
+@@ -167,7 +175,7 @@ endif ()
+ # ----------------------------------------------------------------------
+ # Zstd
+ 
+-if (NOT "${ZSTD_HOME}" STREQUAL "")
++if (NOT "${ZSTD_HOME}" STREQUAL "" OR ORC_PACKAGE_KIND STREQUAL "conan")
+   find_package (ZSTD REQUIRED)
+   set(ZSTD_VENDORED FALSE)
+ else ()
+@@ -208,12 +216,18 @@ endif ()
+ 
+ add_library (orc_zstd INTERFACE)
+ add_library (orc::zstd ALIAS orc_zstd)
+-if (ORC_PREFER_STATIC_ZSTD AND ${ZSTD_STATIC_LIB})
++if (ORC_PACKAGE_KIND STREQUAL "conan")
++  target_link_libraries (orc_zstd INTERFACE ${zstd_LIBRARIES})
++elseif (ORC_PREFER_STATIC_ZSTD AND ${ZSTD_STATIC_LIB})
+   target_link_libraries (orc_zstd INTERFACE ${ZSTD_STATIC_LIB})
+ else ()
+   target_link_libraries (orc_zstd INTERFACE ${ZSTD_LIBRARY})
+ endif ()
+-target_include_directories (orc_zstd SYSTEM INTERFACE ${ZSTD_INCLUDE_DIR})
++if (ORC_PACKAGE_KIND STREQUAL "conan")
++  target_include_directories (orc_zstd SYSTEM INTERFACE ${zstd_INCLUDE_DIR})
++else()
++  target_include_directories (orc_zstd SYSTEM INTERFACE ${ZSTD_INCLUDE_DIR})
++endif ()
+ 
+ if (ZSTD_VENDORED)
+   add_dependencies (orc_zstd zstd_ep)
+@@ -226,7 +240,7 @@ endif ()
+ # ----------------------------------------------------------------------
+ # LZ4
+ 
+-if (NOT "${LZ4_HOME}" STREQUAL "")
++if (NOT "${LZ4_HOME}" STREQUAL "" OR ORC_PACKAGE_KIND STREQUAL "conan")
+   find_package (LZ4 REQUIRED)
+   set(LZ4_VENDORED FALSE)
+ else ()
+@@ -260,12 +274,18 @@ endif ()
+ 
+ add_library (orc_lz4 INTERFACE)
+ add_library (orc::lz4 ALIAS orc_lz4)
+-if (ORC_PREFER_STATIC_LZ4 AND ${LZ4_STATIC_LIB})
++if (ORC_PACKAGE_KIND STREQUAL "conan")
++  target_link_libraries (orc_lz4 INTERFACE ${lz4_LIBRARIES})
++elseif (ORC_PREFER_STATIC_LZ4 AND ${LZ4_STATIC_LIB})
+   target_link_libraries (orc_lz4 INTERFACE ${LZ4_STATIC_LIB})
+ else ()
+   target_link_libraries (orc_lz4 INTERFACE ${LZ4_LIBRARY})
+ endif ()
+-target_include_directories (orc_lz4 SYSTEM INTERFACE ${LZ4_INCLUDE_DIR})
++if (ORC_PACKAGE_KIND STREQUAL "conan")
++  target_include_directories (orc_lz4 SYSTEM INTERFACE ${lz4_INCLUDE_DIR})
++else()
++  target_include_directories (orc_lz4 SYSTEM INTERFACE ${LZ4_INCLUDE_DIR})
++endif ()
+ 
+ if (LZ4_VENDORED)
+   add_dependencies (orc_lz4 lz4_ep)
+@@ -377,7 +397,7 @@ endif ()
+ # ----------------------------------------------------------------------
+ # Protobuf
+ 
+-if (NOT "${PROTOBUF_HOME}" STREQUAL "")
++if (NOT "${PROTOBUF_HOME}" STREQUAL "" OR ORC_PACKAGE_KIND STREQUAL "conan")
+   find_package (Protobuf REQUIRED)
+   set(PROTOBUF_VENDORED FALSE)
+ else ()
+@@ -426,14 +446,23 @@ add_library (orc::protobuf ALIAS orc_protobuf)
+ add_library (orc_protoc INTERFACE)
+ add_library (orc::protoc ALIAS orc_protoc)
+ 
+-if (ORC_PREFER_STATIC_PROTOBUF AND ${PROTOBUF_STATIC_LIB})
++if (ORC_PACKAGE_KIND STREQUAL "conan")
++  target_link_libraries (orc_protobuf INTERFACE ${protobuf_LIBRARIES})
++elseif (ORC_PREFER_STATIC_PROTOBUF AND ${PROTOBUF_STATIC_LIB})
+   target_link_libraries (orc_protobuf INTERFACE ${PROTOBUF_STATIC_LIB})
+ else ()
+   target_link_libraries (orc_protobuf INTERFACE ${PROTOBUF_LIBRARY})
+ endif()
+-target_include_directories (orc_protobuf SYSTEM INTERFACE 
${PROTOBUF_INCLUDE_DIR})
++if (ORC_PACKAGE_KIND STREQUAL "conan")
++  target_include_directories (orc_protobuf SYSTEM INTERFACE 
${protobuf_INCLUDE_DIR})
++else ()
++  target_include_directories (orc_protobuf SYSTEM INTERFACE 
${PROTOBUF_INCLUDE_DIR})
++endif ()
+ 
+-if (ORC_PREFER_STATIC_PROTOBUF AND ${PROTOC_STATIC_LIB})
++if (ORC_PACKAGE_KIND STREQUAL "conan")
++  cmake_path(GET protobuf_INCLUDE_DIR PARENT_PATH PROTOBUF_HOME)
++  set(PROTOBUF_EXECUTABLE ${PROTOBUF_HOME}/bin/protoc)
++elseif (ORC_PREFER_STATIC_PROTOBUF AND ${PROTOC_STATIC_LIB})
+   target_link_libraries (orc_protoc INTERFACE ${PROTOC_STATIC_LIB})
+ else ()
+   target_link_libraries (orc_protoc INTERFACE ${PROTOC_LIBRARY})
diff --git a/conan/patches/0001-thirdparty-toolchain-1.9.x.patch 
b/conan/patches/0001-thirdparty-toolchain-1.9.x.patch
new file mode 100644
index 000000000..4164855a1
--- /dev/null
+++ b/conan/patches/0001-thirdparty-toolchain-1.9.x.patch
@@ -0,0 +1,182 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 3cbd88632..dd4e154c5 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -76,6 +76,10 @@ option(BUILD_ENABLE_AVX512
+     "Enable build with AVX512 at compile time"
+     OFF)
+ 
++option(ORC_PACKAGE_KIND
++    "Arbitrary string that identifies the kind of package"
++    "")
++
+ # Make sure that a build type is selected
+ if (NOT CMAKE_BUILD_TYPE)
+   message(STATUS "No build type selected, default to ReleaseWithDebugInfo")
+diff --git a/cmake_modules/ThirdpartyToolchain.cmake 
b/cmake_modules/ThirdpartyToolchain.cmake
+index 47c1a65ba..8695918a6 100644
+--- a/cmake_modules/ThirdpartyToolchain.cmake
++++ b/cmake_modules/ThirdpartyToolchain.cmake
+@@ -71,7 +71,7 @@ endif ()
+ # ----------------------------------------------------------------------
+ # Snappy
+ 
+-if (NOT "${SNAPPY_HOME}" STREQUAL "")
++if (NOT "${SNAPPY_HOME}" STREQUAL "" OR ORC_PACKAGE_KIND STREQUAL "conan")
+   find_package (Snappy REQUIRED)
+   set(SNAPPY_VENDORED FALSE)
+ else ()
+@@ -97,12 +97,18 @@ endif ()
+ 
+ add_library (orc_snappy INTERFACE)
+ add_library (orc::snappy ALIAS orc_snappy)
+-if (ORC_PREFER_STATIC_SNAPPY AND ${SNAPPY_STATIC_LIB})
++if (ORC_PACKAGE_KIND STREQUAL "conan")
++  target_link_libraries(orc_snappy INTERFACE ${Snappy_LIBRARIES})
++elseif (ORC_PREFER_STATIC_SNAPPY AND ${SNAPPY_STATIC_LIB})
+   target_link_libraries(orc_snappy INTERFACE ${SNAPPY_STATIC_LIB})
+ else ()
+   target_link_libraries(orc_snappy INTERFACE ${SNAPPY_LIBRARY})
+ endif ()
+-target_include_directories (orc_snappy SYSTEM INTERFACE ${SNAPPY_INCLUDE_DIR})
++if (ORC_PACKAGE_KIND STREQUAL "conan")
++  target_include_directories (orc_snappy SYSTEM INTERFACE 
${Snappy_INCLUDE_DIR})
++else()
++  target_include_directories (orc_snappy SYSTEM INTERFACE 
${SNAPPY_INCLUDE_DIR})
++endif ()
+ 
+ if (SNAPPY_VENDORED)
+   add_dependencies (orc_snappy snappy_ep)
+@@ -115,7 +121,7 @@ endif ()
+ # ----------------------------------------------------------------------
+ # ZLIB
+ 
+-if (NOT "${ZLIB_HOME}" STREQUAL "")
++if (NOT "${ZLIB_HOME}" STREQUAL "" OR ORC_PACKAGE_KIND STREQUAL "conan")
+   find_package (ZLIB REQUIRED)
+   set(ZLIB_VENDORED FALSE)
+ else ()
+@@ -149,7 +155,9 @@ endif ()
+ 
+ add_library (orc_zlib INTERFACE)
+ add_library (orc::zlib ALIAS orc_zlib)
+-if (ORC_PREFER_STATIC_ZLIB AND ${ZLIB_STATIC_LIB})
++if (ORC_PACKAGE_KIND STREQUAL "conan")
++  target_link_libraries (orc_zlib INTERFACE ${ZLIB_LIBRARIES})
++elseif (ORC_PREFER_STATIC_ZLIB AND ${ZLIB_STATIC_LIB})
+   target_link_libraries (orc_zlib INTERFACE ${ZLIB_STATIC_LIB})
+ else ()
+   target_link_libraries (orc_zlib INTERFACE ${ZLIB_LIBRARY})
+@@ -167,7 +175,7 @@ endif ()
+ # ----------------------------------------------------------------------
+ # Zstd
+ 
+-if (NOT "${ZSTD_HOME}" STREQUAL "")
++if (NOT "${ZSTD_HOME}" STREQUAL "" OR ORC_PACKAGE_KIND STREQUAL "conan")
+   find_package (ZSTD REQUIRED)
+   set(ZSTD_VENDORED FALSE)
+ else ()
+@@ -208,12 +216,18 @@ endif ()
+ 
+ add_library (orc_zstd INTERFACE)
+ add_library (orc::zstd ALIAS orc_zstd)
+-if (ORC_PREFER_STATIC_ZSTD AND ${ZSTD_STATIC_LIB})
++if (ORC_PACKAGE_KIND STREQUAL "conan")
++  target_link_libraries (orc_zstd INTERFACE ${zstd_LIBRARIES})
++elseif (ORC_PREFER_STATIC_ZSTD AND ${ZSTD_STATIC_LIB})
+   target_link_libraries (orc_zstd INTERFACE ${ZSTD_STATIC_LIB})
+ else ()
+   target_link_libraries (orc_zstd INTERFACE ${ZSTD_LIBRARY})
+ endif ()
+-target_include_directories (orc_zstd SYSTEM INTERFACE ${ZSTD_INCLUDE_DIR})
++if (ORC_PACKAGE_KIND STREQUAL "conan")
++  target_include_directories (orc_zstd SYSTEM INTERFACE ${zstd_INCLUDE_DIR})
++else()
++  target_include_directories (orc_zstd SYSTEM INTERFACE ${ZSTD_INCLUDE_DIR})
++endif ()
+ 
+ if (ZSTD_VENDORED)
+   add_dependencies (orc_zstd zstd_ep)
+@@ -226,7 +240,7 @@ endif ()
+ # ----------------------------------------------------------------------
+ # LZ4
+ 
+-if (NOT "${LZ4_HOME}" STREQUAL "")
++if (NOT "${LZ4_HOME}" STREQUAL "" OR ORC_PACKAGE_KIND STREQUAL "conan")
+   find_package (LZ4 REQUIRED)
+   set(LZ4_VENDORED FALSE)
+ else ()
+@@ -260,12 +274,18 @@ endif ()
+ 
+ add_library (orc_lz4 INTERFACE)
+ add_library (orc::lz4 ALIAS orc_lz4)
+-if (ORC_PREFER_STATIC_LZ4 AND ${LZ4_STATIC_LIB})
++if (ORC_PACKAGE_KIND STREQUAL "conan")
++  target_link_libraries (orc_lz4 INTERFACE ${lz4_LIBRARIES})
++elseif (ORC_PREFER_STATIC_LZ4 AND ${LZ4_STATIC_LIB})
+   target_link_libraries (orc_lz4 INTERFACE ${LZ4_STATIC_LIB})
+ else ()
+   target_link_libraries (orc_lz4 INTERFACE ${LZ4_LIBRARY})
+ endif ()
+-target_include_directories (orc_lz4 SYSTEM INTERFACE ${LZ4_INCLUDE_DIR})
++if (ORC_PACKAGE_KIND STREQUAL "conan")
++  target_include_directories (orc_lz4 SYSTEM INTERFACE ${lz4_INCLUDE_DIR})
++else()
++  target_include_directories (orc_lz4 SYSTEM INTERFACE ${LZ4_INCLUDE_DIR})
++endif ()
+ 
+ if (LZ4_VENDORED)
+   add_dependencies (orc_lz4 lz4_ep)
+@@ -381,7 +401,7 @@ endif ()
+ # ----------------------------------------------------------------------
+ # Protobuf
+ 
+-if (NOT "${PROTOBUF_HOME}" STREQUAL "")
++if (NOT "${PROTOBUF_HOME}" STREQUAL "" OR ORC_PACKAGE_KIND STREQUAL "conan")
+   find_package (Protobuf REQUIRED)
+   set(PROTOBUF_VENDORED FALSE)
+ else ()
+@@ -430,14 +450,23 @@ add_library (orc::protobuf ALIAS orc_protobuf)
+ add_library (orc_protoc INTERFACE)
+ add_library (orc::protoc ALIAS orc_protoc)
+ 
+-if (ORC_PREFER_STATIC_PROTOBUF AND ${PROTOBUF_STATIC_LIB})
++if (ORC_PACKAGE_KIND STREQUAL "conan")
++  target_link_libraries (orc_protobuf INTERFACE ${protobuf_LIBRARIES})
++elseif (ORC_PREFER_STATIC_PROTOBUF AND ${PROTOBUF_STATIC_LIB})
+   target_link_libraries (orc_protobuf INTERFACE ${PROTOBUF_STATIC_LIB})
+ else ()
+   target_link_libraries (orc_protobuf INTERFACE ${PROTOBUF_LIBRARY})
+ endif()
+-target_include_directories (orc_protobuf SYSTEM INTERFACE 
${PROTOBUF_INCLUDE_DIR})
++if (ORC_PACKAGE_KIND STREQUAL "conan")
++  target_include_directories (orc_protobuf SYSTEM INTERFACE 
${protobuf_INCLUDE_DIR})
++else ()
++  target_include_directories (orc_protobuf SYSTEM INTERFACE 
${PROTOBUF_INCLUDE_DIR})
++endif ()
+ 
+-if (ORC_PREFER_STATIC_PROTOBUF AND ${PROTOC_STATIC_LIB})
++if (ORC_PACKAGE_KIND STREQUAL "conan")
++  cmake_path(GET protobuf_INCLUDE_DIR PARENT_PATH PROTOBUF_HOME)
++  set(PROTOBUF_EXECUTABLE ${PROTOBUF_HOME}/bin/protoc)
++elseif (ORC_PREFER_STATIC_PROTOBUF AND ${PROTOC_STATIC_LIB})
+   target_link_libraries (orc_protoc INTERFACE ${PROTOC_STATIC_LIB})
+ else ()
+   target_link_libraries (orc_protoc INTERFACE ${PROTOC_LIBRARY})
diff --git a/conan/test_package/CMakeLists.txt 
b/conan/test_package/CMakeLists.txt
new file mode 100644
index 000000000..58279fc14
--- /dev/null
+++ b/conan/test_package/CMakeLists.txt
@@ -0,0 +1,24 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+cmake_minimum_required(VERSION 3.15)
+project(PackageTest CXX)
+
+find_package(orc CONFIG REQUIRED)
+
+add_executable(example src/example.cpp)
+target_link_libraries(example orc::orc)
diff --git a/conan/test_package/conanfile.py b/conan/test_package/conanfile.py
new file mode 100644
index 000000000..c47c37709
--- /dev/null
+++ b/conan/test_package/conanfile.py
@@ -0,0 +1,42 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import os
+
+from conan import ConanFile
+from conan.tools.cmake import CMake, cmake_layout
+from conan.tools.build import can_run
+
+class OrcTestConan(ConanFile):
+    settings = "os", "compiler", "build_type", "arch"
+    generators = "CMakeDeps", "CMakeToolchain"
+
+    def requirements(self):
+        self.requires(self.tested_reference_str)
+
+    def build(self):
+        cmake = CMake(self)
+        cmake.configure()
+        cmake.build()
+
+    def layout(self):
+        cmake_layout(self)
+
+    def test(self):
+        if can_run(self):
+            cmd = os.path.join(self.cpp.build.bindir, "example")
+            self.run(cmd, env="conanrun")
diff --git a/conan/test_package/src/example.cpp 
b/conan/test_package/src/example.cpp
new file mode 100644
index 000000000..52f056e85
--- /dev/null
+++ b/conan/test_package/src/example.cpp
@@ -0,0 +1,26 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <orc/OrcFile.hh>
+#include <iostream>
+
+int main() {
+  auto orcType = orc::Type::buildTypeFromString("struct<a:int,b:string>");
+  std::cout << orcType->toString() << std::endl;
+  return 0;
+}


Reply via email to