-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
50 lines (43 loc) · 1.38 KB
/
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(xyhttpd)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
include(GoogleTest OPTIONAL)
find_package(OpenSSL)
find_package(ZLIB)
find_package(PkgConfig)
find_library(GTEST_LIBRARIES NAMES gtest gtest_main)
pkg_search_module(LIBUV REQUIRED libuv)
include_directories(include)
set(HEADER_FILES
include/xycommon.h
include/xyfcgi.h
include/xyfiber.h
include/xyhttp.h
include/xyhttpsvc.h
include/xyhttptls.h
include/xystream.h
)
set(SOURCE_FILES
src/httpcore/xybase64.cpp
src/httpcore/xyfcgi.cpp
src/httpcore/xyfiber.cpp
src/httpcore/xyhttp.cpp
src/httpcore/xyhttpapi.cpp
src/httpcore/xyhttpsvc.cpp
src/httpcore/xyhttptls.cpp
src/httpcore/xystream.cpp
)
add_library(iocore ${SOURCE_FILES} ${HEADER_FILES})
target_link_libraries(iocore ${LIBUV_LIBRARIES} ${ZLIB_LIBRARIES} ${OPENSSL_LIBRARIES})
add_executable(tinyhttpd src/tinyhttpd/tinyhttpd.cpp)
target_link_libraries(tinyhttpd iocore)
if(GTEST_LIBRARIES)
enable_testing()
add_executable(test-io test/test-io.cpp)
target_link_libraries(test-io iocore ${GTEST_LIBRARIES} gtest_main pthread)
gtest_discover_tests(test-io)
else()
message(STATUS "Note: "
"Google Test is not found on your system. Unit tests are skipped.")
endif()