-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
50 lines (33 loc) · 1007 Bytes
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
cmake_minimum_required(VERSION 3.5)
project(uvtls VERSION 0.1 DESCRIPTION "TLS for libuv")
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
####
option(BUILD_SHARED_LIBS "Build shared library" OFF)
option(BUILD_EXAMPLES "Build examples" ON)
option(BUILD_TESTS "Build tests" ON)
option(TLS_BACKEND "TLS/SSL library to use for the backend")
####
include(FindLibuv)
list(APPEND LIBRARIES ${LIBUV_LIBRARIES})
list(APPEND INCLUDE_DIRS ${LIBUV_INCLUDE_DIRS})
####
if(${TLS_BACKEND} STREQUAL "OpenSSL" OR NOT TLS_BACKEND)
find_package(OpenSSL)
if (OPENSSL_FOUND)
set(TLS_BACKEND "OpenSSL")
endif()
list(APPEND LIBRARIES ${OPENSSL_LIBRARIES})
list(APPEND INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR})
else()
message(FATAL_ERROR "Unsupport TLS backend: ${TLS_BACKEND}")
endif()
####
list(APPEND INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include)
####
add_subdirectory(src)
if (BUILD_TESTS)
add_subdirectory(tests)
endif()
if (BUILD_EXAMPLES)
add_subdirectory(examples)
endif()