CMakeLists.txt 722 B

1234567891011121314151617
  1. set(TARGET echoserver)
  2. set(GENERATED_SOURCES
  3. ${CMAKE_CURRENT_BINARY_DIR}/simpletest.grpc.pb.cc
  4. ${CMAKE_CURRENT_BINARY_DIR}/simpletest.pb.cc
  5. ${CMAKE_CURRENT_BINARY_DIR}/testservice.grpc.pb.cc
  6. ${CMAKE_CURRENT_BINARY_DIR}/testservice.pb.cc)
  7. set_source_files_properties(${GENERATED_SOURCES} PROPERTIES GENERATED TRUE)
  8. add_executable(${TARGET} main.cpp ${GENERATED_SOURCES})
  9. target_link_libraries(${TARGET} gRPC::grpc++ protobuf::libprotobuf)
  10. target_include_directories(${TARGET} PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
  11. file(GLOB PROTO_FILES ABSOLUTE ${CMAKE_CURRENT_SOURCE_DIR}/../proto/*.proto)
  12. protobuf_generate_all(TARGET ${TARGET}
  13. GENERATED_SOURCES ${GENERATED_SOURCES}
  14. PROTO_FILES ${PROTO_FILES})