Skip to content

Commit

Permalink
Detect Homebrew's OpenSSL automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Feb 8, 2023
1 parent 376264b commit a9b2c3d
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion cpp/cmake_modules/ThirdpartyToolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4821,11 +4821,34 @@ macro(build_awssdk)
DEPENDS aws_c_common_ep)
add_dependencies(AWS::aws-checksums aws_checksums_ep)

set(S2N_TLS_CMAKE_ARGS ${AWSSDK_COMMON_CMAKE_ARGS})
if(APPLE AND NOT OPENSSL_ROOT_DIR)
find_program(BREW brew)
if(BREW)
execute_process(COMMAND ${BREW} --prefix "openssl@1.1"
OUTPUT_VARIABLE OPENSSL11_BREW_PREFIX
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(OPENSSL11_BREW_PREFIX)
set(OPENSSL_ROOT_DIR ${OPENSSL11_BREW_PREFIX})
else()
execute_process(COMMAND ${BREW} --prefix "openssl"
OUTPUT_VARIABLE OPENSSL_BREW_PREFIX
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(OPENSSL_BREW_PREFIX)
set(OPENSSL_ROOT_DIR ${OPENSSL_BREW_PREFIX})
endif()
endif()
endif()
endif()
if(OPENSSL_ROOT_DIR)
# For Findcrypto.cmake in s2n-tls.
list(APPEND S2N_TLS_CMAKE_ARGS -DCMAKE_PREFIX_PATH=${OPENSSL_ROOT_DIR})
endif()
externalproject_add(s2n_tls_ep
${EP_COMMON_OPTIONS}
URL ${S2N_TLS_SOURCE_URL}
URL_HASH "SHA256=${ARROW_S2N_TLS_BUILD_SHA256_CHECKSUM}"
CMAKE_ARGS ${AWSSDK_COMMON_CMAKE_ARGS}
CMAKE_ARGS ${S2N_TLS_CMAKE_ARGS}
BUILD_BYPRODUCTS ${S2N_TLS_STATIC_LIBRARY})
add_dependencies(AWS::s2n-tls s2n_tls_ep)

Expand Down

0 comments on commit a9b2c3d

Please sign in to comment.