Skip to content

Commit 090e18b

Browse files
authored
Merge pull request cpp-netlib#694 from anonimal/cherry-pick-acb020b
OSX: update OpenSSL detection. Closes cpp-netlib#690
2 parents 48e315d + fb6a375 commit 090e18b

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

CMakeLists.txt

+17-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,23 @@ set(Boost_USE_MULTI_THREADED ON)
4848
find_package(Boost 1.58.0 REQUIRED COMPONENTS system)
4949

5050
if (CPP-NETLIB_ENABLE_HTTPS)
51-
find_package( OpenSSL )
51+
if (APPLE)
52+
# If we're on OSX check for Homebrew's copy of OpenSSL instead of Apple's
53+
if (NOT OpenSSL_DIR)
54+
find_program(HOMEBREW brew)
55+
if (HOMEBREW STREQUAL "HOMEBREW-NOTFOUND")
56+
message(WARNING "Homebrew not found: not using Homebrew's OpenSSL")
57+
if (NOT OPENSSL_ROOT_DIR)
58+
message(WARNING "Use -DOPENSSL_ROOT_DIR for non-Apple OpenSSL")
59+
endif()
60+
else()
61+
execute_process(COMMAND brew --prefix openssl
62+
OUTPUT_VARIABLE OPENSSL_ROOT_DIR
63+
OUTPUT_STRIP_TRAILING_WHITESPACE)
64+
endif()
65+
endif()
66+
endif()
67+
find_package(OpenSSL)
5268
endif()
5369

5470
find_package( Threads )

0 commit comments

Comments
 (0)