split cyassl and openssl sources, add ssl library abstraction
[project/ustream-ssl.git] / CMakeLists.txt
1 cmake_minimum_required(VERSION 2.6)
2
3 PROJECT(ustream-ssl C)
4 ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -g3 -Wmissing-declarations)
5
6 SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
7
8 IF(APPLE)
9   INCLUDE_DIRECTORIES(/opt/local/include)
10   LINK_DIRECTORIES(/opt/local/lib)
11 ENDIF()
12
13 IF(CYASSL)
14   SET(SSL_SRC ustream-io-cyassl.c ustream-openssl.c)
15   SET(SSL_LIB cyassl m)
16 ELSE()
17   SET(SSL_SRC ustream-io-openssl.c ustream-openssl.c)
18   SET(SSL_LIB crypto ssl)
19 ENDIF()
20
21 ADD_LIBRARY(ustream-ssl SHARED ustream-ssl.c ${SSL_SRC})
22 TARGET_LINK_LIBRARIES(ustream-ssl ubox ${SSL_LIB})
23
24 ADD_EXECUTABLE(ustream-example ustream-example.c)
25 TARGET_LINK_LIBRARIES(ustream-example ustream-ssl)
26
27 FILE(GLOB headers *.h)
28 INSTALL(FILES ${headers}
29         DESTINATION include/libubox
30 )
31 INSTALL(TARGETS ustream-ssl
32         LIBRARY DESTINATION lib
33 )