Skip to content

Commit

Permalink
Set environment variable for OpenSSL in CMake file (facebookincubator…
Browse files Browse the repository at this point in the history
…#5309)

Summary:
Folly needs OpenSSL 1.1 version to function. In the presence of other
OpenSSL versions, it is possible that folly in bundled mode can pick up
other incompatible versions causing the build to fail.

Currently, in the `setup-macos.sh` script, we set
OPENSSL_ROOT_DIR=$(brew --prefix [email protected]).

We require a similar change for the bundled folly installs as well.
To achieve this goal, we now set the `OPENSSL_ROOT_DIR` environment
variable via the CMake file to set the path to the correct version of
OpenSSL.

Resolves facebookincubator#1446, facebookincubator#5309
  • Loading branch information
rishitc committed Oct 17, 2023
1 parent 5afb621 commit 6caf530
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions CMake/resolve_dependency_modules/folly/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,23 @@ resolve_dependency_url(FOLLY)

message(STATUS "Building Folly from source")

if(APPLE AND NOT DEFINED OPENSSL_ROOT_DIR)
find_program(BREW brew)
if(BREW)
execute_process(
COMMAND brew --prefix [email protected]
OUTPUT_VARIABLE OPENSSL_ROOT_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(ENV{OPENSSL_ROOT_DIR} ${OPENSSL_ROOT_DIR})
endif()
if(NOT OPENSSL_ROOT_DIR)
message(
FATAL_ERROR
"Unable to locate brew prefix for OpenSSL 1.1. Please install with `brew install [email protected]` or set OPENSSL_ROOT_DIR"
)
endif()
endif()

if(gflags_SOURCE STREQUAL "BUNDLED")
set(glog_patch && git apply ${CMAKE_CURRENT_LIST_DIR}/folly-gflags-glog.patch)
endif()
Expand Down

0 comments on commit 6caf530

Please sign in to comment.