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 452f11c392 ARROW-16792: [C++][CMake] Add support for using Arrow
options when Arrow is used as subproject (#13348)
452f11c392 is described below
commit 452f11c392ffba728484fb69922096356fb56f68
Author: Sutou Kouhei <[email protected]>
AuthorDate: Fri Jun 10 10:15:21 2022 +0900
ARROW-16792: [C++][CMake] Add support for using Arrow options when Arrow is
used as subproject (#13348)
Authored-by: Sutou Kouhei <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
---
ci/conan/all/conanfile.py | 5 +++--
cpp/cmake_modules/DefineOptions.cmake | 6 ++++++
cpp/cmake_modules/ThirdpartyToolchain.cmake | 18 ++++++++++--------
3 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/ci/conan/all/conanfile.py b/ci/conan/all/conanfile.py
index b1149711ed..54fff62fae 100644
--- a/ci/conan/all/conanfile.py
+++ b/ci/conan/all/conanfile.py
@@ -178,7 +178,7 @@ class ArrowConan(ConanFile):
def _compute(self, required=False):
if required or self.options.compute == "auto":
- return bool(self.options.dataset_modules)
+ return bool(self.options.dataset_modules) or
bool(self.options.parquet)
else:
return bool(self.options.compute)
@@ -190,7 +190,7 @@ class ArrowConan(ConanFile):
def _with_re2(self, required=False):
if required or self.options.with_re2 == "auto":
- return bool(self.options.gandiva)
+ return bool(self.options.gandiva) or bool(self._compute())
else:
return bool(self.options.with_re2)
@@ -340,6 +340,7 @@ class ArrowConan(ConanFile):
self._cmake.definitions["CMAKE_SYSTEM_PROCESSOR"] =
cmake_system_processor
if self.settings.compiler == "Visual Studio":
self._cmake.definitions["ARROW_USE_STATIC_CRT"] = "MT" in
str(self.settings.compiler.runtime)
+ self._cmake.definitions["ARROW_DEFINE_OPTIONS"] = True
self._cmake.definitions["ARROW_DEPENDENCY_SOURCE"] = "SYSTEM"
self._cmake.definitions["ARROW_GANDIVA"] = self.options.gandiva
self._cmake.definitions["ARROW_PARQUET"] = self.options.parquet
diff --git a/cpp/cmake_modules/DefineOptions.cmake
b/cpp/cmake_modules/DefineOptions.cmake
index 1195fbc3b1..2e4db6ae12 100644
--- a/cpp/cmake_modules/DefineOptions.cmake
+++ b/cpp/cmake_modules/DefineOptions.cmake
@@ -83,6 +83,12 @@ endmacro()
# Top level cmake dir
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
+ set(ARROW_DEFINE_OPTIONS_DEFAULT ON)
+else()
+ set(ARROW_DEFINE_OPTIONS_DEFAULT OFF)
+endif()
+option(ARROW_DEFINE_OPTIONS "Define Arrow options"
${ARROW_DEFINE_OPTIONS_DEFAULT})
+if(ARROW_DEFINE_OPTIONS)
#----------------------------------------------------------------------
set_option_category("Compile and link")
diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake
b/cpp/cmake_modules/ThirdpartyToolchain.cmake
index 4518576b56..4082b7d2ce 100644
--- a/cpp/cmake_modules/ThirdpartyToolchain.cmake
+++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake
@@ -2440,15 +2440,17 @@ if(ARROW_WITH_RE2)
# source not uses C++ 11.
resolve_dependency(re2 HAVE_ALT TRUE)
if(${re2_SOURCE} STREQUAL "SYSTEM")
- get_target_property(RE2_LIB re2::re2
IMPORTED_LOCATION_${UPPERCASE_BUILD_TYPE})
- if(NOT RE2_LIB)
- get_target_property(RE2_LIB re2::re2 IMPORTED_LOCATION_RELEASE)
- endif()
- if(NOT RE2_LIB)
- get_target_property(RE2_LIB re2::re2 IMPORTED_LOCATION)
+ get_target_property(RE2_TYPE re2::re2 TYPE)
+ if(NOT RE2_TYPE STREQUAL "INTERFACE_LIBRARY")
+ get_target_property(RE2_LIB re2::re2
IMPORTED_LOCATION_${UPPERCASE_BUILD_TYPE})
+ if(NOT RE2_LIB)
+ get_target_property(RE2_LIB re2::re2 IMPORTED_LOCATION_RELEASE)
+ endif()
+ if(NOT RE2_LIB)
+ get_target_property(RE2_LIB re2::re2 IMPORTED_LOCATION)
+ endif()
+ string(APPEND ARROW_PC_LIBS_PRIVATE " ${RE2_LIB}")
endif()
-
- string(APPEND ARROW_PC_LIBS_PRIVATE " ${RE2_LIB}")
endif()
add_definitions(-DARROW_WITH_RE2)
endif()