# - Try to find OpenSSL # Once done, this will define # # OPENSSL_FOUND - system has OpenSSL # OPENSSL_INCLUDE_DIRS - the OpenSSL include directories # OPENSSL_LIBRARIES - link these to use OpenSSL include(FindPkgMacros) findpkg_begin(OPENSSL) # Get path, convert backslashes as ${ENV_${var}} getenv_path(OPENSSL_HOME) # If OPENSSL_ROOT was defined in the environment, use it. if (NOT OPENSSL_HOME) if(NOT "$ENV{OPENSSL_HOME}" STREQUAL "") set(OPENSSL_HOME $ENV{OPENSSL_ROOT}) endif() endif() # construct search paths set(OPENSSL_PREFIX_PATH ${OPENSSL_HOME} ${ENV_OPENSSL_HOME}) create_search_paths(OPENSSL) # redo search if prefix path changed clear_if_changed(OPENSSL_PREFIX_PATH OPENSSL_LIBRARY_FWK OPENSSL_LIBRARY_REL OPENSSL_LIBRARY_DBG OPENSSL_INCLUDE_DIR ) if (SCOLDEPS_PLATFORM_X64) set(OPENSSL_LIBRARY_NAMES OpenSSL ssl libssl ssleay64) else (SCOLDEPS_PLATFORM_X64) set(OPENSSL_LIBRARY_NAMES OpenSSL ssl libssl ssleay32) endif (SCOLDEPS_PLATFORM_X64) get_debug_names(OPENSSL_LIBRARY_NAMES) if (SCOLDEPS_PLATFORM_X64) set(CRYPTO_LIBRARY_NAMES Crypto crypto libcrypto libeay64) else (SCOLDEPS_PLATFORM_X64) set(CRYPTO_LIBRARY_NAMES Crypto crypto libcrypto libeay32) endif (SCOLDEPS_PLATFORM_X64) get_debug_names(CRYPTO_LIBRARY_NAMES) findpkg_framework(OPENSSL) set(OPENSSL_SUBPATH linux) if(APPLE) if (OSX) set(OPENSSL_SUBPATH OSX) else() set(OPENSSL_SUBPATH IOS) endif() endif() find_path(OPENSSL_INCLUDE_DIR NAMES openssl/crypto.h PATHS NO_DEFAULT_PATH HINTS ${OPENSSL_INC_SEARCH_PATH} ${OPENSSL_PKGC_INCLUDE_DIRS}) find_library(OPENSSL_LIBRARY_REL NAMES ${OPENSSL_LIBRARY_NAMES} PATHS NO_DEFAULT_PATH HINTS ${OPENSSL_LIB_SEARCH_PATH} ${OPENSSL_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" Release RelWithDebInfo MinSizeRel ${ANDROID_ABI} ${SCOL_INSTALL_PREFIX} ${OPENSSL_SUBPATH}) find_library(OPENSSL_LIBRARY_DBG NAMES ${OPENSSL_LIBRARY_NAMES_DBG} PATHS NO_DEFAULT_PATH HINTS ${OPENSSL_LIB_SEARCH_PATH} ${OPENSSL_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" Debug ${ANDROID_ABI} ${SCOL_INSTALL_PREFIX} ${OPENSSL_SUBPATH}) find_library(CRYPTO_LIBRARY_REL NAMES ${CRYPTO_LIBRARY_NAMES} PATHS NO_DEFAULT_PATH HINTS ${OPENSSL_LIB_SEARCH_PATH} ${OPENSSL_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" Release RelWithDebInfo MinSizeRel ${ANDROID_ABI} ${SCOL_INSTALL_PREFIX} ${OPENSSL_SUBPATH}) find_library(CRYPTO_LIBRARY_DBG NAMES ${CRYPTO_LIBRARY_NAMES_DBG} PATHS NO_DEFAULT_PATH HINTS ${OPENSSL_LIB_SEARCH_PATH} ${OPENSSL_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" Debug ${ANDROID_ABI} ${SCOL_INSTALL_PREFIX} ${OPENSSL_SUBPATH}) make_library_set(OPENSSL_LIBRARY) make_library_set(CRYPTO_LIBRARY) findpkg_finish(OPENSSL) set(OPENSSL_LIBRARIES ${OPENSSL_LIBRARIES} ${CRYPTO_LIBRARY})