X-Git-Url: http://git.openwrt.org/?a=blobdiff_plain;f=CMakeLists.txt;h=49e79a1f2694fe88ba70f62bf0daf1f4037250ff;hb=ec80adaa1b47f28d426fa19c692011ce60b992d6;hp=f6009e7ba6824521c016758eee17255b6531a06d;hpb=e8ec1e56c3ec71b0eeeeac8842b6519548f3c695;p=project%2Fustream-ssl.git diff --git a/CMakeLists.txt b/CMakeLists.txt index f6009e7..49e79a1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,20 +1,27 @@ cmake_minimum_required(VERSION 2.6) +INCLUDE(CheckIncludeFiles) + PROJECT(ustream-ssl C) ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -g3 -Wmissing-declarations) SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") -IF(APPLE) - INCLUDE_DIRECTORIES(/opt/local/include) - LINK_DIRECTORIES(/opt/local/lib) -ENDIF() - -IF(POLARSSL) +IF(MBEDTLS) + ADD_DEFINITIONS(-DHAVE_MBEDTLS) + SET(SSL_SRC ustream-mbedtls.c) + SET(SSL_LIB mbedtls mbedcrypto mbedx509 m) +ELSEIF(POLARSSL) ADD_DEFINITIONS(-DHAVE_POLARSSL) SET(SSL_SRC ustream-polarssl.c) SET(SSL_LIB polarssl m) ELSEIF(CYASSL) + CHECK_INCLUDE_FILES (cyassl/version.h HAVE_CYASSL_VERSION_H) + SET(CMAKE_EXTRA_INCLUDE_FILES cyassl/ssl.h) + IF (HAVE_CYASSL_VERSION_H) + ADD_DEFINITIONS(-DHAVE_CYASSL_VERSION_H) + ENDIF() + ADD_DEFINITIONS(-DHAVE_CYASSL) SET(SSL_SRC ustream-io-cyassl.c ustream-openssl.c) SET(SSL_LIB cyassl m) ELSE() @@ -22,11 +29,17 @@ ELSE() SET(SSL_LIB crypto ssl) ENDIF() +FIND_PATH(ubox_include_dir libubox/ustream.h) +INCLUDE_DIRECTORIES(${ubox_include_dir}) + ADD_LIBRARY(ustream-ssl SHARED ustream-ssl.c ${SSL_SRC}) TARGET_LINK_LIBRARIES(ustream-ssl ubox ${SSL_LIB}) -ADD_EXECUTABLE(ustream-example ustream-example.c) -TARGET_LINK_LIBRARIES(ustream-example ustream-ssl) +ADD_EXECUTABLE(ustream-example-server ustream-example-server.c) +TARGET_LINK_LIBRARIES(ustream-example-server ustream-ssl) + +ADD_EXECUTABLE(ustream-example-client ustream-example-client.c) +TARGET_LINK_LIBRARIES(ustream-example-client ustream-ssl) INSTALL(FILES ustream-ssl.h DESTINATION include/libubox