-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
72 lines (64 loc) · 1.42 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
cmake_minimum_required(VERSION 3.7)
# Name of this project
project(proto_rpc_example)
add_subdirectory(proto_rpc)
# Existing libraries this project uses
find_package(
Boost REQUIRED
program_options
system
)
find_package(
Protobuf REQUIRED
)
# Location of include files
include_directories(
proto_rpc/include
${Boost_INCLUDE_DIRS}
${PROTOBUF_INCLUDE_DIRS}
${CMAKE_CURRENT_BINARY_DIR} # for files generated by protoc
)
# Example service library
add_custom_command(
OUTPUT dictionary_service.pb.h dictionary_service.pb.cc
COMMAND protoc --cpp_out=${CMAKE_CURRENT_BINARY_DIR} dictionary_service.proto
DEPENDS proto/dictionary_service.proto
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/proto
)
add_library(
dictionary_service
${CMAKE_CURRENT_BINARY_DIR}/dictionary_service.pb.cc
)
# Example executables
add_executable(
dictionary_server
src/dictionary_server.cpp
)
add_executable(
dictionary_client
src/dictionary_client.cpp
)
# Compile options
target_compile_options(
dictionary_server PRIVATE
"/D_WIN32_WINNT=0x0501"
)
target_compile_options(
dictionary_client PRIVATE
"/D_WIN32_WINNT=0x0501"
)
# Library dependences
target_link_libraries(
dictionary_service
${PROTOBUF_LIBRARIES}
)
target_link_libraries(
dictionary_server
proto_rpc
dictionary_service
)
target_link_libraries(
dictionary_client
proto_rpc
dictionary_service
)