You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ko...@apache.org on 2021/06/08 07:51:03 UTC
[arrow] branch master updated: ARROW-13002: [C++] Add a check for
the utf8proc's version in CMake
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 30f52a2 ARROW-13002: [C++] Add a check for the utf8proc's version in CMake
30f52a2 is described below
commit 30f52a202d0a2f6393366ea1e4a8e5182077c72a
Author: Anthony Louis <an...@simbioseventures.com>
AuthorDate: Tue Jun 8 16:49:40 2021 +0900
ARROW-13002: [C++] Add a check for the utf8proc's version in CMake
It adds a function in CMake to retrieve the used version of the `utf8proc` library and sets a required version to be used by CMake.
The PR complements the [10468](https://github.com/apache/arrow/pull/10468) one, that fixed the bug related to broken builds in Ubuntu 18.04
Closes #10477 from anthonylouisbsb/feature/add-check-for-utf8proc
Authored-by: Anthony Louis <an...@simbioseventures.com>
Signed-off-by: Sutou Kouhei <ko...@clear-code.com>
---
cpp/cmake_modules/Findutf8proc.cmake | 35 +++++++++++++++++++++++++++--
cpp/cmake_modules/ThirdpartyToolchain.cmake | 2 +-
2 files changed, 34 insertions(+), 3 deletions(-)
diff --git a/cpp/cmake_modules/Findutf8proc.cmake b/cpp/cmake_modules/Findutf8proc.cmake
index edea73b..03c720d 100644
--- a/cpp/cmake_modules/Findutf8proc.cmake
+++ b/cpp/cmake_modules/Findutf8proc.cmake
@@ -15,6 +15,31 @@
# specific language governing permissions and limitations
# under the License.
+function(extract_utf8proc_version)
+ if(utf8proc_INCLUDE_DIR)
+ file(READ "${utf8proc_INCLUDE_DIR}/utf8proc.h" UTF8PROC_H_CONTENT)
+
+ string(REGEX MATCH "#define UTF8PROC_VERSION_MAJOR [0-9]+"
+ UTF8PROC_MAJOR_VERSION_DEFINITION "${UTF8PROC_H_CONTENT}")
+ string(REGEX MATCH "#define UTF8PROC_VERSION_MINOR [0-9]+"
+ UTF8PROC_MINOR_VERSION_DEFINITION "${UTF8PROC_H_CONTENT}")
+ string(REGEX MATCH "#define UTF8PROC_VERSION_PATCH [0-9]+"
+ UTF8PROC_PATCH_VERSION_DEFINITION "${UTF8PROC_H_CONTENT}")
+
+ string(REGEX MATCH "[0-9]+$" UTF8PROC_MAJOR_VERSION
+ "${UTF8PROC_MAJOR_VERSION_DEFINITION}")
+ string(REGEX MATCH "[0-9]+$" UTF8PROC_MINOR_VERSION
+ "${UTF8PROC_MINOR_VERSION_DEFINITION}")
+ string(REGEX MATCH "[0-9]+$" UTF8PROC_PATCH_VERSION
+ "${UTF8PROC_PATCH_VERSION_DEFINITION}")
+ set(utf8proc_VERSION
+ "${UTF8PROC_MAJOR_VERSION}.${UTF8PROC_MINOR_VERSION}.${UTF8PROC_PATCH_VERSION}"
+ PARENT_SCOPE)
+ else()
+ set(utf8proc_VERSION "" PARENT_SCOPE)
+ endif()
+endfunction(extract_utf8proc_version)
+
if(ARROW_UTF8PROC_USE_SHARED)
set(utf8proc_LIB_NAMES)
if(CMAKE_IMPORT_LIBRARY_SUFFIX)
@@ -44,6 +69,7 @@ if(utf8proc_ROOT)
PATHS ${utf8proc_ROOT}
NO_DEFAULT_PATH
PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES})
+ extract_utf8proc_version()
else()
find_library(utf8proc_LIB
NAMES ${utf8proc_LIB_NAMES}
@@ -51,10 +77,15 @@ else()
find_path(utf8proc_INCLUDE_DIR
NAMES utf8proc.h
PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES})
+ extract_utf8proc_version()
endif()
-find_package_handle_standard_args(utf8proc REQUIRED_VARS utf8proc_LIB
- utf8proc_INCLUDE_DIR)
+find_package_handle_standard_args(utf8proc
+ REQUIRED_VARS
+ utf8proc_LIB
+ utf8proc_INCLUDE_DIR
+ VERSION_VAR
+ utf8proc_VERSION)
if(utf8proc_FOUND)
set(utf8proc_FOUND TRUE)
diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake
index ff55936..1350f27 100644
--- a/cpp/cmake_modules/ThirdpartyToolchain.cmake
+++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake
@@ -2275,7 +2275,7 @@ macro(build_utf8proc)
endmacro()
if(ARROW_WITH_UTF8PROC)
- resolve_dependency(utf8proc)
+ resolve_dependency(utf8proc REQUIRED_VERSION "2.2.0")
add_definitions(-DARROW_WITH_UTF8PROC)