diff options
Diffstat (limited to 'Tests/FindProtobuf/Test/CMakeLists.txt')
-rw-r--r-- | Tests/FindProtobuf/Test/CMakeLists.txt | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Tests/FindProtobuf/Test/CMakeLists.txt b/Tests/FindProtobuf/Test/CMakeLists.txt index fc6b37e951..84041eaf4e 100644 --- a/Tests/FindProtobuf/Test/CMakeLists.txt +++ b/Tests/FindProtobuf/Test/CMakeLists.txt @@ -52,3 +52,16 @@ target_include_directories(test_desc PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) target_link_libraries(test_desc msgs ${Protobuf_LIBRARIES}) target_compile_features(test_desc PRIVATE cxx_std_11) add_test(NAME test_desc COMMAND test_desc ${DESC_PROTO_DESC}) + +if(CMake_TEST_FindProtobuf_gRPC) + find_program(gRPC_CPP_PLUGIN grpc_cpp_plugin) + add_library(msgs_grpc msgs/example_service.proto) + target_include_directories(msgs_grpc PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) + target_link_libraries(msgs_grpc PUBLIC ${Protobuf_LIBRARIES}) + protobuf_generate(TARGET msgs_grpc LANGUAGE cpp) + protobuf_generate(TARGET msgs_grpc LANGUAGE grpc GENERATE_EXTENSIONS .grpc.pb.h .grpc.pb.cc PLUGIN "protoc-gen-grpc=${gRPC_CPP_PLUGIN}") + + add_executable(test_generate_grpc main-generate-grpc.cxx) + target_link_libraries(test_generate_grpc PRIVATE msgs_grpc) + add_test(NAME test_generate_grpc COMMAND test_generate_grpc) +endif() |