1 cmake_minimum_required(VERSION 2.6) 2 3 PROJECT(ustream-ssl C) 4 5 ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -g3) 6 IF(CMAKE_C_COMPILER_VERSION VERSION_GREATER 6) 7 ADD_DEFINITIONS(-Wextra -Werror=implicit-function-declaration) 8 ADD_DEFINITIONS(-Wformat -Werror=format-security -Werror=format-nonliteral) 9 ENDIF() 10 ADD_DEFINITIONS(-Wno-unused-parameter -Wmissing-declarations) 11 12 SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") 13 IF (NOT APPLE) 14 SET(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined") 15 ENDIF() 16 17 IF(MBEDTLS) 18 ADD_DEFINITIONS(-DHAVE_MBEDTLS) 19 SET(SSL_SRC ustream-mbedtls.c) 20 FIND_LIBRARY(mbedtls_library mbedtls) 21 FIND_LIBRARY(mbedx509_library mbedx509) 22 FIND_LIBRARY(mbedcrypto_library mbedcrypto) 23 SET(SSL_LIB ${mbedtls_library} ${mbedx509_library} ${mbedcrypto_library} m) 24 ELSEIF(WOLFSSL) 25 ADD_DEFINITIONS(-DHAVE_WOLFSSL) 26 FIND_LIBRARY(wolfssl_library wolfssl) 27 SET(SSL_SRC ustream-io-wolfssl.c ustream-openssl.c) 28 SET(SSL_LIB ${wolfssl_library} m) 29 SET(CMAKE_REQUIRED_LIBRARIES "${wolfssl_library} -lm") 30 ELSE() 31 SET(SSL_SRC ustream-io-openssl.c ustream-openssl.c) 32 SET(SSL_LIB crypto ssl) 33 ENDIF() 34 35 FIND_PATH(ubox_include_dir libubox/ustream.h) 36 INCLUDE_DIRECTORIES(${ubox_include_dir}) 37 FIND_LIBRARY(ubox_library NAMES ubox) 38 39 ADD_LIBRARY(ustream-ssl SHARED ustream-ssl.c ${SSL_SRC}) 40 TARGET_LINK_LIBRARIES(ustream-ssl ${ubox_library} ${SSL_LIB}) 41 42 ADD_EXECUTABLE(ustream-example-server ustream-example-server.c) 43 TARGET_LINK_LIBRARIES(ustream-example-server ustream-ssl) 44 45 ADD_EXECUTABLE(ustream-example-client ustream-example-client.c) 46 TARGET_LINK_LIBRARIES(ustream-example-client ustream-ssl) 47 48 TARGET_COMPILE_DEFINITIONS(ustream-ssl PRIVATE $<$<CONFIG:Debug>:DEBUG>) 49 50 INSTALL(FILES ustream-ssl.h 51 DESTINATION include/libubox 52 ) 53 INSTALL(TARGETS ustream-ssl 54 LIBRARY DESTINATION lib 55 ) 56 57 IF(ABIVERSION) 58 SET_TARGET_PROPERTIES(ustream-ssl PROPERTIES VERSION ${ABIVERSION}) 59 ENDIF()
This page was automatically generated by LXR 0.3.1. • OpenWrt