IF(APPLE)
    IF(NOT OpenSSL_DIR)
        EXECUTE_PROCESS(COMMAND brew --prefix openssl
                        OUTPUT_VARIABLE OPENSSL_ROOT_DIR
                        OUTPUT_STRIP_TRAILING_WHITESPACE)
        MESSAGE(STATUS "Found OpenSSL Prefix: ${OPENSSL_ROOT_DIR}")
    ENDIF()
ENDIF()

FIND_PACKAGE(OpenSSL)
IF(OPENSSL_FOUND AND (NOT LCB_NO_SSL))
    INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR})
    ADD_DEFINITIONS(${OPENSSL_DEFINITIONS})
    ADD_LIBRARY(lcbssl OBJECT ssl_e.c ssl_c.c ssl_common.c)
    SET(lcb_ssl_libs ${OPENSSL_LIBRARIES} PARENT_SCOPE)
    SET(lcb_ssl_objs $<TARGET_OBJECTS:lcbssl> PARENT_SCOPE)
    LCB_UTIL(lcbssl)
    MESSAGE(STATUS "SSL Found")
ELSE()
    SET(LCB_NO_SSL ON PARENT_SCOPE)
    SET(lcb_ssl_libs "" PARENT_SCOPE)
    MESSAGE(STATUS "SSL Not Found")
ENDIF()
