cmake: add mbed TLS detection

This commit is contained in:
Marc-André Moreau 2015-09-15 20:52:46 -04:00
parent 5f66420de6
commit 8e3baed882
3 changed files with 48 additions and 0 deletions

View File

@ -493,6 +493,10 @@ set(OPENSSL_FEATURE_TYPE "REQUIRED")
set(OPENSSL_FEATURE_PURPOSE "cryptography")
set(OPENSSL_FEATURE_DESCRIPTION "encryption, certificate validation, hashing functions")
set(MBEDTLS_FEATURE_TYPE "OPTIONAL")
set(MBEDTLS_FEATURE_PURPOSE "cryptography")
set(MBEDTLS_FEATURE_DESCRIPTION "encryption, certificate validation, hashing functions")
set(OPENSLES_FEATURE_TYPE "OPTIONAL")
set(OPENSLES_FEATURE_PURPOSE "multimedia")
set(OPENSLES_FEATURE_DESCRIPTION "OpenSLES audio / video")
@ -609,6 +613,7 @@ endif()
find_feature(ZLIB ${ZLIB_FEATURE_TYPE} ${ZLIB_FEATURE_PURPOSE} ${ZLIB_FEATURE_DESCRIPTION})
find_feature(OpenSSL ${OPENSSL_FEATURE_TYPE} ${OPENSSL_FEATURE_PURPOSE} ${OPENSSL_FEATURE_DESCRIPTION})
find_feature(MbedTLS ${MBEDTLS_FEATURE_TYPE} ${MBEDTLS_FEATURE_PURPOSE} ${MBEDTLS_FEATURE_DESCRIPTION})
find_feature(OpenSLES ${OPENSLES_FEATURE_TYPE} ${OPENSLES_FEATURE_PURPOSE} ${OPENSLES_FEATURE_DESCRIPTION})
find_feature(OSS ${OSS_FEATURE_TYPE} ${OSS_FEATURE_PURPOSE} ${OSS_FEATURE_DESCRIPTION})

38
cmake/FindMbedTLS.cmake Normal file
View File

@ -0,0 +1,38 @@
find_path(MBEDTLS_INCLUDE_DIR
NAMES mbedtls/ssl.h
PATH_SUFFIXES include
HINTS ${MBEDTLS_ROOT})
find_library(MBEDTLS_LIBRARY
NAMES mbedtls
PATH_SUFFIXES lib
HINTS ${MBEDTLS_ROOT})
find_library(MBEDCRYPTO_LIBRARY
NAMES mbedcrypto
PATH_SUFFIXES lib
HINTS ${MBEDTLS_ROOT})
find_library(MBEDX509_LIBRARY
NAMES mbedx509
PATH_SUFFIXES lib
HINTS ${MBEDTLS_ROOT})
if(MBEDTLS_INCLUDE_DIR AND MBEDTLS_LIBRARY)
set(MBEDTLS_FOUND TRUE)
set(MBEDTLS_LIBRARIES ${MBEDTLS_LIBRARY} ${MBEDCRYPTO_LIBRARY} ${MBEDX509_LIBRARY})
endif()
if(MBEDTLS_FOUND)
if(NOT MBEDTLS_FIND_QUIETLY)
message(STATUS "Found mbed TLS: ${MBEDTLS_LIBRARIES}")
endif()
else()
if(MBEDTLS_FIND_REQUIRED)
message(FATAL_ERROR "mbed TLS was not found")
endif()
endif()
mark_as_advanced(MBEDTLS_INCLUDE_DIR MBEDTLS_LIBRARY)

View File

@ -33,6 +33,11 @@ freerdp_include_directory_add(${ZLIB_INCLUDE_DIRS})
freerdp_library_add(${OPENSSL_LIBRARIES})
if(MBEDTLS_FOUND)
freerdp_include_directory_add(${MBEDTLS_INCLUDE_DIR})
freerdp_library_add(${MBEDTLS_LIBRARIES})
endif()
if(WIN32)
freerdp_library_add(ws2_32)
else()