Commit 7eb9f924 authored by Otavio Rodolfo Piske's avatar Otavio Rodolfo Piske

Switch to Brew's OpenSSL headers/libraries on OS X

Apple deprecated OpenSSL and stopped providing its headers on newer versions of OS X. These
changes adjust CMake build files so that they look for Brew's OpenSSL instead (or a custom
one if provided by the user).
For other systems, it uses CMake's own search to find headers/libraries.
Signed-off-by: 's avatarOtavio Rodolfo Piske <opiske@redhat.com>
parent eb294bd1
......@@ -72,19 +72,22 @@ INSTALL(FILES MQTTAsync.h MQTTClient.h MQTTClientPersistence.h
IF (PAHO_WITH_SSL)
SET(OPENSSL_LIB_SEARCH_PATH "" CACHE PATH "Directory containing OpenSSL libraries")
SET(OPENSSL_INC_SEARCH_PATH "" CACHE PATH "Directory containing OpenSSL includes")
SET(OPENSSL_LIBRARIES ssl crypto)
find_path(OPENSSL_INCLUDE_DIR openssl/ssl.h
HINTS ${OPENSSL_INC_SEARCH_PATH}/include)
find_library(OPENSSL_LIB NAMES ssl libssl
HINTS ${OPENSSL_DIR}/lib ${OPENSSL_DIR}/lib64)
find_library(OPENSSLCRYPTO_LIB NAMES ssl libssl
HINTS ${OPENSSL_DIR}/lib ${OPENSSL_DIR}/lib64)
IF (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
SET(OPENSSL_BREW_PATH "/usr/local/opt/openssl")
ENDIF (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
message(STATUS "OpenSSL hint ${PENSSL_INC_SEARCH_PATH} (includes) / ")
message(STATUS "OpenSSL headers found at ${OPENSSL_INCLUDE_DIR}")
message(STATUS "OpenSSL library found at ${OPENSSL_LIB}")
message(STATUS "OpenSSL Crypto library found at ${OPENSSLCRYPTO_LIB}")
FIND_PATH(OPENSSL_INCLUDE_DIR openssl/ssl.h
HINTS ${OPENSSL_INC_SEARCH_PATH}/include ${OPENSSL_BREW_PATH}/include/)
FIND_LIBRARY(OPENSSL_LIB NAMES ssl libssl
HINTS ${OPENSSL_BREW_PATH}/lib ${OPENSSL_DIR}/lib ${OPENSSL_DIR}/lib64)
FIND_LIBRARY(OPENSSLCRYPTO_LIB NAMES ssl libssl
HINTS ${OPENSSL_BREW_PATH}/lib ${OPENSSL_DIR}/lib ${OPENSSL_DIR}/lib64)
MESSAGE(STATUS "OpenSSL hint ${PENSSL_INC_SEARCH_PATH} (includes) / ")
MESSAGE(STATUS "OpenSSL headers found at ${OPENSSL_INCLUDE_DIR}")
MESSAGE(STATUS "OpenSSL library found at ${OPENSSL_LIB}")
MESSAGE(STATUS "OpenSSL Crypto library found at ${OPENSSLCRYPTO_LIB}")
INCLUDE_DIRECTORIES(
${OPENSSL_INCLUDE_DIR}
......@@ -105,4 +108,3 @@ SET(OPENSSL_LIB_SEARCH_PATH "" CACHE PATH "Directory containing OpenSSL librarie
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib)
ENDIF()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment