forked from facebook/mvfst
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
99 lines (86 loc) · 2.43 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
cmake_minimum_required(VERSION 3.10)
project(
mvfst
)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# QUIC_FBCODE_ROOT is where the top level quic/ directory resides, so
# an #include <quic/path/to/file> will resolve to
# $QUIC_FBCODE_ROOT/quic/path/to/file on disk
set(QUIC_FBCODE_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
# Dependencies
find_package(Boost 1.58
REQUIRED COMPONENTS
iostreams
system
thread
filesystem
regex
context
)
find_package(folly REQUIRED)
find_package(Fizz REQUIRED)
find_package(Glog REQUIRED)
find_package(Threads)
SET(GFLAG_DEPENDENCIES "")
SET(QUIC_EXTRA_LINK_LIBRARIES "")
SET(QUIC_EXTRA_INCLUDE_DIRECTORIES "")
# find_package(gflags COMPONENTS static)
find_package(gflags CONFIG QUIET)
if (gflags_FOUND)
message("module path: ${CMAKE_MODULE_PATH}")
message(STATUS "Found gflags from package config")
if (TARGET gflags-shared)
list(APPEND GFLAG_DEPENDENCIES gflags-shared)
elseif (TARGET gflags)
list(APPEND GFLAG_DEPENDENCIES gflags)
else()
message(FATAL_ERROR "Unable to determine the target name for the GFlags package.")
endif()
list(APPEND CMAKE_REQUIRED_LIBRARIES ${GFLAGS_LIBRARIES})
list(APPEND CMAKE_REQUIRED_INCLUDES ${GFLAGS_INCLUDE_DIR})
else()
find_package(Gflags REQUIRED MODULE)
list(APPEND QUIC_EXTRA_LINK_LIBRARIES ${LIBGFLAGS_LIBRARY})
list(APPEND QUIC_EXTRA_INCLUDE_DIRECTORIES ${LIBGFLAGS_INCLUDE_DIR})
list(APPEND CMAKE_REQUIRED_LIBRARIES ${LIBGFLAGS_LIBRARY})
list(APPEND CMAKE_REQUIRED_INCLUDES ${LIBGFLAGS_INCLUDE_DIR})
endif()
list(APPEND
_QUIC_COMMON_COMPILE_OPTIONS
-std=c++14
-Wall
-Wextra
# more strict options
-Werror=sign-compare
-Werror=bool-compare
-Werror=unused-variable
-Woverloaded-virtual
-Wnon-virtual-dtor
)
include(QuicTest)
add_subdirectory(quic)
if(BUILD_TESTS)
enable_testing()
find_package(GTest REQUIRED)
find_package(GMock REQUIRED)
endif()
install(
EXPORT mvfst-exports
FILE mvfst-targets.cmake
NAMESPACE mvfst::
DESTINATION lib/cmake/mvfst/
)
include(CMakePackageConfigHelpers)
configure_package_config_file(
cmake/mvfst-config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/mvfst-config.cmake
INSTALL_DESTINATION lib/cmake/mvfst/
)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/mvfst-config.cmake
DESTINATION lib/cmake/mvfst/
)