-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
46 lines (33 loc) · 1.07 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
cmake_minimum_required(VERSION 3.7.2)
project(helloworld CXX)
set (CMAKE_CXX_STANDARD 17)
find_package(gRPC CONFIG REQUIRED)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
# This is just a convenience.
# You should be able to set this to whatever folder you like.
set(PROTO_GENERATED_FOLDER ${CMAKE_CURRENT_BINARY_DIR})
set(PROJECT_SOURCE_FILES src/server.cc)
# Clang-Tidy
set(CMAKE_CXX_CLANG_TIDY
clang-tidy)
# Clang-format
include("clang_format")
clang_format(${PROJECT_SOURCE_FILES})
# Address/UB Sanitizers
include ("sanitizers")
# GRPC and Proto generation
include ("grpc")
grpc_generate("proto/helloworld.proto"
${PROTO_GENERATED_FOLDER}
PROTO_SRCS
PROTO_HDRS
GRPC_SRCS
GRPC_HDRS)
# Finally building
add_executable(server
${PROJECT_SOURCE_FILES}
${PROTO_SRCS}
${GRPC_SRCS})
# the destination for our generated files is CMAKE_CURRENT_BINARY
target_include_directories(server PRIVATE ${PROTO_GENERATED_FOLDER})
target_link_libraries(server PRIVATE gRPC::gpr gRPC::grpc gRPC::grpc++ gRPC::grpc++_alts gRPC::grpc++_reflection)