You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by md...@apache.org on 2019/06/16 09:34:43 UTC

[arrow] branch master updated: ARROW-5524: [C++] Turn off PARQUET_BUILD_ENCRYPTION in CMake if OpenSSL not found (#4494)

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

mdeepak 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 9b912a7  ARROW-5524: [C++] Turn off PARQUET_BUILD_ENCRYPTION in CMake if OpenSSL not found (#4494)
9b912a7 is described below

commit 9b912a728809e4cfd7cf2013dd6ee182f8c6d0d5
Author: Neal Richardson <ne...@gmail.com>
AuthorDate: Sun Jun 16 02:34:38 2019 -0700

    ARROW-5524: [C++] Turn off PARQUET_BUILD_ENCRYPTION in CMake if OpenSSL not found (#4494)
    
    * Turn off PARQUET_BUILD_ENCRYPTION in CMake if OpenSSL not found
    
    * Refactor the OpenSSL CMake logic
    
    * Refactor
    
    * Fix copypasta
    
    * Lint
---
 cpp/CMakeLists.txt                          |  2 +-
 cpp/cmake_modules/DefineOptions.cmake       |  4 ++--
 cpp/cmake_modules/ThirdpartyToolchain.cmake | 20 +++++++++++++++++++-
 3 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index 5d9daf8..ea6aa74 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -560,7 +560,7 @@ if(ARROW_WITH_URIPARSER)
   list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS uriparser::uriparser)
 endif()
 
-if(PARQUET_BUILD_ENCRYPTION)
+if(ARROW_USE_OPENSSL)
   list(APPEND ARROW_LINK_LIBS OpenSSL::Crypto)
   list(APPEND ARROW_STATIC_LINK_LIBS OpenSSL::Crypto)
   list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS OpenSSL::Crypto)
diff --git a/cpp/cmake_modules/DefineOptions.cmake b/cpp/cmake_modules/DefineOptions.cmake
index 5d39f61..10ec8ad 100644
--- a/cpp/cmake_modules/DefineOptions.cmake
+++ b/cpp/cmake_modules/DefineOptions.cmake
@@ -280,8 +280,6 @@ Note that this requires linking Boost statically" OFF)
   #----------------------------------------------------------------------
   set_option_category("Parquet")
 
-  define_option(PARQUET_BUILD_ENCRYPTION "Build Parquet with encryption support" ON)
-
   define_option(PARQUET_MINIMAL_DEPENDENCY
                 "Depend only on Thirdparty headers to build libparquet. \
 Always OFF if building binaries" OFF)
@@ -293,6 +291,8 @@ Always OFF if building binaries" OFF)
   define_option(PARQUET_BUILD_EXAMPLES
                 "Build the Parquet examples. Requires static libraries to be built." OFF)
 
+  define_option(PARQUET_REQUIRE_ENCRYPTION "Fail if OpenSSL is not found" OFF)
+
   #----------------------------------------------------------------------
   set_option_category("Gandiva")
 
diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake
index 0e37d92..3d922e1 100644
--- a/cpp/cmake_modules/ThirdpartyToolchain.cmake
+++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake
@@ -745,8 +745,24 @@ if(ARROW_WITH_BROTLI)
   include_directories(SYSTEM ${BROTLI_INCLUDE_DIR})
 endif()
 
-if(PARQUET_BUILD_ENCRYPTION OR ARROW_WITH_GRPC)
+set(ARROW_USE_OPENSSL OFF)
+if(PARQUET_REQUIRE_ENCRYPTION AND NOT ARROW_PARQUET)
+  set(PARQUET_REQUIRE_ENCRYPTION OFF)
+endif()
+if(PARQUET_REQUIRE_ENCRYPTION OR ARROW_FLIGHT)
+  # This must work
   find_package(OpenSSL REQUIRED)
+  set(ARROW_USE_OPENSSL ON)
+elseif(ARROW_PARQUET)
+  # Enable Parquet encryption if OpenSSL is there, but don't fail if it's not
+  find_package(OpenSSL QUIET)
+  if(OPENSSL_FOUND)
+    set(ARROW_USE_OPENSSL ON)
+  endif()
+endif()
+
+if(ARROW_USE_OPENSSL)
+  message(STATUS "Building with OpenSSL support")
   # OpenSSL::SSL and OpenSSL::Crypto
   # are not available in older CMake versions (CMake < v3.2).
   if(NOT TARGET OpenSSL::SSL)
@@ -764,6 +780,8 @@ if(PARQUET_BUILD_ENCRYPTION OR ARROW_WITH_GRPC)
   endif()
 
   include_directories(SYSTEM ${OPENSSL_INCLUDE_DIR})
+else()
+  message(STATUS "Building without OpenSSL support")
 endif()
 
 # ----------------------------------------------------------------------