set (OPENSSL_USE_STATIC_LIBS ${USE_STATIC_LIBRARIES})
if (APPLE)
	set (OPENSSL_ROOT_DIR "/usr/local/opt/openssl")
endif ()
find_package (OpenSSL)
if (OPENSSL_FOUND)
	include_directories (${OPENSSL_INCLUDE_DIR})
endif ()
if (NOT OPENSSL_FOUND)
	# Try to find manually.
	include_directories ("/usr/local/opt/openssl/include")
	set (OPENSSL_HINTS "/usr/local/opt/openssl/lib")
	if (USE_STATIC_LIBRARIES)
		find_library (OPENSSL_SSL_LIBRARY libssl.a HINTS ${OPENSSL_HINTS})
		find_library (OPENSSL_CRYPTO_LIBRARY libcrypto.a HINTS ${OPENSSL_HINTS})
	else ()
		find_library (OPENSSL_SSL_LIBRARY ssl HINTS ${OPENSSL_HINTS})
		find_library (OPENSSL_CRYPTO_LIBRARY crypto HINTS ${OPENSSL_HINTS})
	endif ()
	set (OPENSSL_LIBRARIES ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY})
endif ()
