-
Notifications
You must be signed in to change notification settings - Fork 11
/
CMakeLists.txt
38 lines (33 loc) · 1.22 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
CMAKE_MINIMUM_REQUIRED(VERSION 3.5)
PROJECT(lsquic-tutorial C)
IF(CMAKE_BUILD_TYPE STREQUAL "")
SET(CMAKE_BUILD_TYPE Debug)
ENDIF()
MESSAGE(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
IF (CMAKE_BUILD_TYPE STREQUAL Debug)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0")
ELSEIF (CMAKE_BUILD_TYPE STREQUAL Debug)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2")
ENDIF()
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} $ENV{EXTRA_CFLAGS}")
MESSAGE(STATUS "Compiler flags: ${CMAKE_C_FLAGS}")
ADD_SUBDIRECTORY(boringssl)
INCLUDE_DIRECTORIES(boringssl/include)
INCLUDE_DIRECTORIES(lsquic/include)
INCLUDE_DIRECTORIES(lsquic/src/liblsquic) # For lsquic_xxhash.h
ADD_SUBDIRECTORY(lsquic/src/liblsquic)
INCLUDE_DIRECTORIES(libev)
ADD_EXECUTABLE(tut tut.c)
ADD_EXECUTABLE(h3cli h3cli.c)
SET(LIBS lsquic crypto ssl z m)
IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
# If using older glibc, need to link with -lrt. See clock_getres(2).
EXECUTE_PROCESS(
COMMAND ${PROJECT_SOURCE_DIR}/print-glibc-version.sh ${CMAKE_C_COMPILER}
OUTPUT_VARIABLE GLIBC_VERSION)
IF(NOT GLIBC_VERSION EQUAL "" AND GLIBC_VERSION VERSION_LESS 2.17)
SET(LIBS ${LIBS} rt)
ENDIF()
ENDIF()
TARGET_LINK_LIBRARIES(tut ${LIBS})
TARGET_LINK_LIBRARIES(h3cli ${LIBS})