Created
October 9, 2021 11:24
-
-
Save sighingnow/e158d713b4b6aa189d35bb87519c5de4 to your computer and use it in GitHub Desktop.
CMake: find brew-installed openssl on Mac
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
macro(find_openssl_libraries) | |
if (APPLE) | |
# If we're on OS X check for Homebrew's copy of OpenSSL instead of Apple's | |
if (NOT OpenSSL_DIR) | |
find_program(HOMEBREW brew) | |
if (HOMEBREW STREQUAL "HOMEBREW-NOTFOUND") | |
message(WARNING "Homebrew not found: not using Homebrew's OpenSSL") | |
if (NOT OPENSSL_ROOT_DIR) | |
message(WARNING "Use -DOPENSSL_ROOT_DIR for non-Apple OpenSSL") | |
endif() | |
else() | |
execute_process(COMMAND brew --prefix openssl | |
OUTPUT_VARIABLE OPENSSL_ROOT_DIR | |
OUTPUT_STRIP_TRAILING_WHITESPACE) | |
endif() | |
endif() | |
endif() | |
find_package(OpenSSL ${ARGN}) | |
if (OPENSSL_FOUND) | |
include_directories(SYSTEM ${OPENSSL_INCLUDE_DIR}) | |
endif() | |
endmacro(find_openssl_libraries) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment