2009-02-02 17:44:46 +03:00
|
|
|
# - Try to find OpenSSL
|
|
|
|
# Once done this will define
|
|
|
|
#
|
|
|
|
# OPENSSL_FOUND - system has OpenSSL
|
|
|
|
# OPENSSL_INCLUDE_DIRS - the OpenSSL include directory
|
|
|
|
# OPENSSL_LIBRARIES - Link these to use OpenSSL
|
|
|
|
# OPENSSL_DEFINITIONS - Compiler switches required for using OpenSSL
|
|
|
|
#
|
2010-03-30 01:14:04 +04:00
|
|
|
# Copyright (c) 2009-2010 Andreas Schneider <mail@cynapses.org>
|
2009-02-02 17:44:46 +03:00
|
|
|
#
|
|
|
|
# Redistribution and use is allowed according to the terms of the New
|
|
|
|
# BSD license.
|
|
|
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
if (OPENSSL_LIBRARIES AND OPENSSL_INCLUDE_DIRS)
|
|
|
|
# in cache already
|
|
|
|
set(OPENSSL_FOUND TRUE)
|
|
|
|
else (OPENSSL_LIBRARIES AND OPENSSL_INCLUDE_DIRS)
|
2010-07-13 16:03:25 +04:00
|
|
|
if (WIN32)
|
|
|
|
set(_OPENSSL_DIR $ENV{PROGRAMFILES}/OpenSSL)
|
|
|
|
endif (WIN32)
|
|
|
|
|
2010-03-30 01:14:04 +04:00
|
|
|
find_package(PkgConfig)
|
|
|
|
if (PKG_CONFIG_FOUND)
|
|
|
|
pkg_check_modules(_OPENSSL openssl)
|
|
|
|
endif (PKG_CONFIG_FOUND)
|
2009-02-02 17:44:46 +03:00
|
|
|
|
|
|
|
find_path(OPENSSL_INCLUDE_DIR
|
|
|
|
NAMES
|
|
|
|
openssl/ssl.h
|
|
|
|
PATHS
|
2010-05-12 15:55:32 +04:00
|
|
|
${_OPENSSL_DIR}/include
|
2009-02-02 17:44:46 +03:00
|
|
|
${_OPENSSL_INCLUDEDIR}
|
|
|
|
/usr/include
|
|
|
|
/usr/local/include
|
|
|
|
/opt/local/include
|
|
|
|
/sw/include
|
2009-08-21 16:54:24 +04:00
|
|
|
/usr/lib/sfw/include
|
2009-02-02 17:44:46 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
find_library(SSL_LIBRARY
|
|
|
|
NAMES
|
|
|
|
ssl
|
2009-07-30 13:38:38 +04:00
|
|
|
libssl
|
2009-02-02 17:44:46 +03:00
|
|
|
PATHS
|
2010-05-12 15:55:32 +04:00
|
|
|
${_OPENSSL_DIR}/lib
|
2009-02-02 17:44:46 +03:00
|
|
|
${_OPENSSL_LIBDIR}
|
|
|
|
/usr/lib
|
|
|
|
/usr/local/lib
|
|
|
|
/opt/local/lib
|
|
|
|
/sw/lib
|
2009-08-24 16:49:07 +04:00
|
|
|
/usr/sfw/lib/64
|
|
|
|
/usr/sfw/lib
|
2009-02-02 17:44:46 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
find_library(SSLEAY32_LIBRARY
|
|
|
|
NAMES
|
|
|
|
ssleay32
|
|
|
|
PATHS
|
2010-05-12 15:55:32 +04:00
|
|
|
${_OPENSSL_DIR}/lib
|
2009-02-02 17:44:46 +03:00
|
|
|
${_OPENSSL_LIBDIR}
|
|
|
|
/usr/lib
|
|
|
|
/usr/local/lib
|
|
|
|
/opt/local/lib
|
|
|
|
/sw/lib
|
2009-08-24 16:49:07 +04:00
|
|
|
/usr/sfw/lib/64
|
|
|
|
/usr/sfw/lib
|
2009-02-02 17:44:46 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
find_library(SSLEAY32MD_LIBRARY
|
|
|
|
NAMES
|
|
|
|
ssleay32MD
|
|
|
|
PATHS
|
2010-05-12 15:55:32 +04:00
|
|
|
${_OPENSSL_DIR}/lib
|
2009-02-02 17:44:46 +03:00
|
|
|
${_OPENSSL_LIBDIR}
|
|
|
|
/usr/lib
|
|
|
|
/usr/local/lib
|
|
|
|
/opt/local/lib
|
|
|
|
/sw/lib
|
2009-08-24 16:49:07 +04:00
|
|
|
/usr/sfw/lib/64
|
|
|
|
/usr/sfw/lib
|
2009-02-02 17:44:46 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
find_library(CRYPTO_LIBRARY
|
|
|
|
NAMES
|
|
|
|
crypto
|
2009-07-30 13:38:38 +04:00
|
|
|
libcrypto
|
2009-08-11 17:37:10 +04:00
|
|
|
eay
|
|
|
|
eay32
|
|
|
|
libeay
|
|
|
|
libeay32
|
2009-02-02 17:44:46 +03:00
|
|
|
PATHS
|
2010-05-12 15:55:32 +04:00
|
|
|
${_OPENSSL_DIR}/lib
|
2009-02-02 17:44:46 +03:00
|
|
|
${_OPENSSL_LIBDIR}
|
|
|
|
/usr/lib
|
|
|
|
/usr/local/lib
|
|
|
|
/opt/local/lib
|
|
|
|
/sw/lib
|
2009-08-24 16:49:07 +04:00
|
|
|
/usr/sfw/lib/64
|
|
|
|
/usr/sfw/lib
|
2009-02-02 17:44:46 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
set(OPENSSL_INCLUDE_DIRS
|
|
|
|
${OPENSSL_INCLUDE_DIR}
|
|
|
|
)
|
|
|
|
|
2010-03-30 01:14:04 +04:00
|
|
|
if (SSL_LIBRARY)
|
2009-02-02 17:44:46 +03:00
|
|
|
set(OPENSSL_LIBRARIES
|
2010-03-30 01:14:04 +04:00
|
|
|
${OPENSSL_LIBRARIES}
|
|
|
|
${SSL_LIBRARY}
|
2009-02-02 17:44:46 +03:00
|
|
|
)
|
2010-03-30 01:14:04 +04:00
|
|
|
endif (SSL_LIBRARY)
|
2009-05-07 19:11:04 +04:00
|
|
|
|
2010-03-30 01:14:04 +04:00
|
|
|
if (SSLEAY32_LIBRARY)
|
2009-02-02 17:44:46 +03:00
|
|
|
set(OPENSSL_LIBRARIES
|
2010-03-30 01:14:04 +04:00
|
|
|
${OPENSSL_LIBRARIES}
|
|
|
|
${SSLEAY32_LIBRARY}
|
2009-02-02 17:44:46 +03:00
|
|
|
)
|
2010-03-30 01:14:04 +04:00
|
|
|
endif (SSLEAY32_LIBRARY)
|
2009-05-07 19:11:04 +04:00
|
|
|
|
2010-03-30 01:14:04 +04:00
|
|
|
if (SSLEAY32MD_LIBRARY)
|
2009-02-02 17:44:46 +03:00
|
|
|
set(OPENSSL_LIBRARIES
|
2010-03-30 01:14:04 +04:00
|
|
|
${OPENSSL_LIBRARIES}
|
|
|
|
${SSLEAY32MD_LIBRARY}
|
2009-02-02 17:44:46 +03:00
|
|
|
)
|
2010-03-30 01:14:04 +04:00
|
|
|
endif (SSLEAY32MD_LIBRARY)
|
2009-05-07 19:11:04 +04:00
|
|
|
|
2010-03-30 01:14:04 +04:00
|
|
|
if (CRYPTO_LIBRARY)
|
2009-02-02 17:44:46 +03:00
|
|
|
set(OPENSSL_LIBRARIES
|
2010-03-30 01:14:04 +04:00
|
|
|
${OPENSSL_LIBRARIES}
|
|
|
|
${CRYPTO_LIBRARY}
|
2009-02-02 17:44:46 +03:00
|
|
|
)
|
2010-03-30 01:14:04 +04:00
|
|
|
endif (CRYPTO_LIBRARY)
|
|
|
|
|
|
|
|
include(FindPackageHandleStandardArgs)
|
|
|
|
find_package_handle_standard_args(OpenSSL DEFAULT_MSG OPENSSL_LIBRARIES OPENSSL_INCLUDE_DIRS)
|
2009-02-02 17:44:46 +03:00
|
|
|
|
|
|
|
# show the OPENSSL_INCLUDE_DIRS and OPENSSL_LIBRARIES variables only in the advanced view
|
|
|
|
mark_as_advanced(OPENSSL_INCLUDE_DIRS OPENSSL_LIBRARIES)
|
|
|
|
|
|
|
|
endif (OPENSSL_LIBRARIES AND OPENSSL_INCLUDE_DIRS)
|
|
|
|
|