-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
117 lines (101 loc) · 2.32 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
cmake_minimum_required(VERSION 3.24)
set(NAME grpc-test)
set(SRCDIR ${CMAKE_SOURCE_DIR}/src)
set(PROTOSDIR ${CMAKE_SOURCE_DIR}/protos)
if (MSVC)
set(
CXXFLAGS
/WX
/W4
/fpermissive
)
else()
set(
CXXFLAGS
-Wall
-Wextra
-Werror
-pedantic
-fpermissive
-fstrict-enums
-fconcepts
-fcoroutines
)
endif()
list(
APPEND
CMAKE_MODULE_PATH
${CMAKE_SOURCE_DIR}/cmake
)
include(generate_protobuf)
project(
grpc-test
DESCRIPTION "gRPC test."
VERSION 1.0.0.0
LANGUAGES C CXX
HOMEPAGE_URL "https://github.com/fontseca/grpc-test"
)
find_package(Protobuf REQUIRED)
find_package(gRPC CONFIG REQUIRED)
find_program(grpc_cpp_plugin_executable grpc_cpp_plugin)
add_executable(
${PROJECT_NAME}
${SRCDIR}/Entry.cc
${PROTOSDIR}/protobuf/models/Client.pb.cc
${PROTOSDIR}/protobuf/models/Invoice.pb.cc
${PROTOSDIR}/protobuf/models/Product.pb.cc
${PROTOSDIR}/protobuf/models/InvoiceDetails.pb.cc
${PROTOSDIR}/protobuf/services/ClientService.pb.cc
${PROTOSDIR}/protobuf/services/ClientService.grpc.pb.cc
${PROTOSDIR}/protobuf/services/InvoiceService.pb.cc
${PROTOSDIR}/protobuf/services/InvoiceService.grpc.pb.cc
${PROTOSDIR}/protobuf/services/ProductService.pb.cc
${PROTOSDIR}/protobuf/services/ProductService.grpc.pb.cc
${PROTOSDIR}/protobuf/common/ServiceStatus.pb.cc
${PROTOSDIR}/protobuf/common/ServiceStatus.grpc.pb.cc
)
generate_protobuf(
${PROTOSDIR}/
${PROTOSDIR}/protobuf
models/Client.proto
models/Invoice.proto
models/Product.proto
models/InvoiceDetails.proto
)
generate_protobuf(
${PROTOSDIR}/
${PROTOSDIR}/protobuf/
services/ClientService.proto
services/ProductService.proto
services/InvoiceService.proto
)
generate_protobuf(
${PROTOSDIR}/
${PROTOSDIR}/protobuf/
common/ServiceStatus.proto
)
target_compile_options(
${PROJECT_NAME}
PRIVATE
${CXXFLAGS}
)
target_compile_features(
${PROJECT_NAME}
PRIVATE
cxx_std_20
)
target_include_directories(
${PROJECT_NAME}
PRIVATE
${Protobuf_INCLUDE_DIRS}/
${CMAKE_SOURCE_DIR}/include/
${CMAKE_SOURCE_DIR}/protos/
${CMAKE_SOURCE_DIR}/protos/protobuf/
)
target_link_libraries(
${PROJECT_NAME}
PRIVATE
protobuf::libprotobuf
gRPC::grpc++
gRPC::grpc++_reflection
)