1 cmake_minimum_required(VERSION 2.6)
3 INCLUDE(CheckSymbolExists)
6 ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -g3 -Wmissing-declarations)
8 SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
11 ADD_DEFINITIONS(-DHAVE_MBEDTLS)
12 SET(SSL_SRC ustream-mbedtls.c)
13 SET(SSL_LIB mbedtls mbedcrypto mbedx509 m)
15 ADD_DEFINITIONS(-DHAVE_WOLFSSL)
16 SET(SSL_SRC ustream-io-wolfssl.c ustream-openssl.c)
17 SET(SSL_LIB wolfssl m)
18 SET(CMAKE_REQUIRED_LIBRARIES "-lwolfssl -lm")
19 CHECK_SYMBOL_EXISTS (wolfSSL_SSLSetIORecv "wolfssl/ssl.h"
20 HAVE_WOLFSSL_SSLSETIORECV)
21 IF (NOT HAVE_WOLFSSL_SSLSETIORECV)
22 ADD_DEFINITIONS(-DNO_WOLFSSL_SSLSETIO_SEND_RECV)
25 SET(SSL_SRC ustream-io-openssl.c ustream-openssl.c)
26 SET(SSL_LIB crypto ssl)
29 FIND_PATH(ubox_include_dir libubox/ustream.h)
30 INCLUDE_DIRECTORIES(${ubox_include_dir})
32 ADD_LIBRARY(ustream-ssl SHARED ustream-ssl.c ${SSL_SRC})
33 TARGET_LINK_LIBRARIES(ustream-ssl ubox ${SSL_LIB})
35 ADD_EXECUTABLE(ustream-example-server ustream-example-server.c)
36 TARGET_LINK_LIBRARIES(ustream-example-server ustream-ssl)
38 ADD_EXECUTABLE(ustream-example-client ustream-example-client.c)
39 TARGET_LINK_LIBRARIES(ustream-example-client ustream-ssl)
41 INSTALL(FILES ustream-ssl.h
42 DESTINATION include/libubox
44 INSTALL(TARGETS ustream-ssl
45 LIBRARY DESTINATION lib