Skip to content

Commit

Permalink
Simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Jun 29, 2023
1 parent fc0a16e commit 3d9da20
Showing 1 changed file with 11 additions and 18 deletions.
29 changes: 11 additions & 18 deletions cpp/cmake_modules/FindOpenSSLAlt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,19 @@ endif()
if(APPLE AND NOT OPENSSL_ROOT_DIR)
find_program(BREW brew)
if(BREW)
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})
else()
execute_process(COMMAND ${BREW} --prefix "openssl@3.0"
OUTPUT_VARIABLE OPENSSL3_BREW_PREFIX
foreach(BREW_OPENSSL_VERSION "" "3" "3.0" "1.1")
set(BREW_OPENSSL_PACKAGE "openssl")
if(BREW_OPENSSL_VERSION)
string(APPEND BREW_OPENSSL_PACKAGE "@${BREW_OPENSSL_VERSION}")
endif()
execute_process(COMMAND ${BREW} --prefix --installed ${BREW_OPENSSL_PACKAGE}
OUTPUT_VARIABLE BREW_OPENSSL_PREFIX
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(OPENSSL11_BREW_PREFIX)
set(OPENSSL_ROOT_DIR ${OPENSSL3_BREW_PREFIX})
else()
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})
endif()
if(BREW_OPENSSL_PREFIX)
set(OPENSSL_ROOT_DIR ${BREW_OPENSSL_PREFIX})
break()
endif()
endif()
endforeach()
endif()
endif()

Expand Down

0 comments on commit 3d9da20

Please sign in to comment.