Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
13016cc4
Commit
13016cc4
authored
8 years ago
by
Konstantin Podsvirov
Browse files
Options
Downloads
Patches
Plain Diff
CMake: project for HelloWorld cpp example
parent
d2b88302
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/cpp/helloworld/CMakeLists.txt
+49
-0
49 additions, 0 deletions
examples/cpp/helloworld/CMakeLists.txt
with
49 additions
and
0 deletions
examples/cpp/helloworld/CMakeLists.txt
0 → 100644
+
49
−
0
View file @
13016cc4
# Minimum CMake required
cmake_minimum_required
(
VERSION 2.8
)
# Project
project
(
HelloWorld CXX
)
# Protobuf
set
(
protobuf_MODULE_COMPATIBLE TRUE
)
find_package
(
protobuf CONFIG REQUIRED
)
message
(
STATUS
"Using protobuf
${
protobuf_VERSION
}
"
)
# gRPC
find_package
(
gRPC CONFIG REQUIRED
)
message
(
STATUS
"Using gRPC
${
gRPC_VERSION
}
"
)
# gRPC C++ plugin
get_target_property
(
gRPC_CPP_PLUGIN_EXECUTABLE gRPC::grpc_cpp_plugin
IMPORTED_LOCATION_RELEASE
)
# Proto file
get_filename_component
(
hw_proto
"../../protos/helloworld.proto"
ABSOLUTE
)
get_filename_component
(
hw_proto_path
"
${
hw_proto
}
"
PATH
)
# Generated sources
protobuf_generate_cpp
(
hw_proto_srcs hw_proto_hdrs
"
${
hw_proto
}
"
)
set
(
hw_grpc_srcs
"
${
CMAKE_CURRENT_BINARY_DIR
}
/helloworld.grpc.pb.cc"
)
set
(
hw_grpc_hdrs
"
${
CMAKE_CURRENT_BINARY_DIR
}
/helloworld.grpc.pb.h"
)
add_custom_command
(
OUTPUT
"
${
hw_grpc_srcs
}
"
"
${
hw_grpc_hdrs
}
"
COMMAND protobuf::protoc
ARGS --grpc_out
"
${
CMAKE_CURRENT_BINARY_DIR
}
"
-I
"
${
hw_proto_path
}
"
--plugin=protoc-gen-grpc=
"
${
gRPC_CPP_PLUGIN_EXECUTABLE
}
"
"
${
hw_proto
}
"
DEPENDS
"
${
hw_proto
}
"
)
# Generated include directory
include_directories
(
"
${
CMAKE_CURRENT_BINARY_DIR
}
"
)
# Targets greeter_[async_](client|server)
foreach
(
_target
greeter_client greeter_server
greeter_async_client greeter_async_server
)
add_executable
(
${
_target
}
"
${
_target
}
.cc"
${
hw_proto_srcs
}
${
hw_grpc_srcs
}
)
target_link_libraries
(
${
_target
}
protobuf::libprotobuf
gRPC::grpc++_unsecure
)
endforeach
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment