-
Notifications
You must be signed in to change notification settings - Fork 503
/
CMakeLists.txt
74 lines (58 loc) · 1.85 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
cmake_minimum_required (VERSION 3.9 FATAL_ERROR)
project(
katran
)
set(CMAKE_MODULE_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/build/fbcode_builder/CMake"
${CMAKE_MODULE_PATH})
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# for modules vended by fbcode_builder and getdeps
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/build/fbcode_builder/CMake)
# KATRAN_FBCODE_ROOT is where the top level katran/ directory resides, so
# an #include <katran/path/to/file> will resolve to
# $KATRAN_FBCODE_ROOT/katran/path/to/file on disk
set(KATRAN_FBCODE_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
set(KATRAN_INCLUDE_DIR "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../>")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
message(STATUS "setting C++ standard to C++${CMAKE_CXX_STANDARD}")
# for clang's compile_commands.json
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Dependencies
find_package(fmt CONFIG REQUIRED)
find_package(folly CONFIG REQUIRED)
find_package(Glog REQUIRED)
find_package(Gflags REQUIRED)
find_package(Threads)
include_directories(".")
add_subdirectory(katran)
if(BUILD_TESTS)
enable_testing()
include(KatranTest)
endif()
if(DEFINED ENV{CMAKE_BUILD_EXAMPLE_THRIFT})
message("Building example of thrift and grpc based katran server")
add_subdirectory(example)
endif()
if(DEFINED ENV{CMAKE_BUILD_EXAMPLE_GRPC})
add_subdirectory(example_grpc)
endif()
if(DEFINED ENV{CMAKE_BUILD_TOOLS})
add_subdirectory(tools)
endif()
install(
EXPORT katran-exports
FILE katran-targets.cmake
NAMESPACE katran::
DESTINATION lib/cmake/katran/
)
include(CMakePackageConfigHelpers)
configure_package_config_file(
cmake/katran-config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/katran-config.cmake
INSTALL_DESTINATION lib/cmake/katran/
)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/katran-config.cmake
DESTINATION lib/cmake/katran/
)