-
Notifications
You must be signed in to change notification settings - Fork 127
/
CMakeLists.txt
executable file
·71 lines (56 loc) · 1.54 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
CMAKE_MINIMUM_REQUIRED(VERSION 3.14)
PROJECT(ANANAS)
SET(CMAKE_CXX_STANDARD 14)
IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
message("Detect linux platform")
ELSEIF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
message("Detect mac platform")
ELSE()
message(FATAL_ERROR "Only support linux or mac")
ENDIF()
OPTION(DEBUG "Debug or release" OFF)
IF(DEBUG)
SET(CMAKE_BUILD_TYPE "Debug")
message("${CMAKE_BUILD_TYPE}")
ELSE()
SET(CMAKE_BUILD_TYPE "Release")
message("${CMAKE_BUILD_TYPE}")
ENDIF()
include(FetchContent)
# nodejs/llhttp
FetchContent_Declare(
llhttp
URL "https://github.com/nodejs/llhttp/archive/refs/tags/release/v6.0.5.tar.gz"
)
FetchContent_MakeAvailable(llhttp)
# gtest
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/47f819c3ca54fb602f432904443e00a0a1fe2f42.zip
)
# For Windows: Prevent overriding the parent project's compiler/linker settings
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
set(BUILD_GMOCK OFF CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/../)
SUBDIRS(net)
SUBDIRS(util)
SUBDIRS(future)
OPTION(USE_SSL "Use ssl or not" OFF)
IF(USE_SSL)
ADD_DEFINITIONS(-DANANAS_DEBUG=1)
SUBDIRS(ssl)
ENDIF()
OPTION(USE_PROTO "Use google protobuf or not" OFF)
FIND_PACKAGE(Protobuf)
IF(PROTOBUF_FOUND)
MESSAGE(STATUS "found protobuf")
SET(USE_PROTO ON)
SUBDIRS(protobuf_rpc)
ENDIF()
IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
SUBDIRS(coroutine)
ENDIF()
SUBDIRS(tests)
SUBDIRS(unittest)
SUBDIRS(examples)