CMakeLists.txt 986 B

12345678910111213141516171819202122232425262728293031
  1. set(generated_sources
  2. ${CMAKE_CURRENT_BINARY_DIR}/simpletest.grpc.pb.cc
  3. ${CMAKE_CURRENT_BINARY_DIR}/simpletest.pb.cc
  4. ${CMAKE_CURRENT_BINARY_DIR}/testservice.grpc.pb.cc
  5. ${CMAKE_CURRENT_BINARY_DIR}/testservice.pb.cc)
  6. set_source_files_properties(${generated_sources} PROPERTIES GENERATED TRUE)
  7. qt_internal_add_executable(echoserver
  8. SOURCES
  9. main.cpp
  10. LIBRARIES
  11. gRPC::grpc++
  12. protobuf::libprotobuf
  13. INCLUDE_DIRECTORIES
  14. $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
  15. )
  16. target_sources(echoserver PRIVATE ${generated_sources})
  17. if(MSVC)
  18. target_compile_definitions(echoserver PRIVATE
  19. _WIN32_WINNT=0x600
  20. _SCL_SECURE_NO_WARNINGS
  21. _CRT_SECURE_NO_WARNINGS
  22. _WINSOCK_DEPRECATED_NO_WARNINGS
  23. )
  24. endif()
  25. file(GLOB proto_files ABSOLUTE ${CMAKE_CURRENT_SOURCE_DIR}/../proto/*.proto)
  26. _qt_internal_protobuf_reference_generate(TARGET echoserver
  27. GENERATED_SOURCES ${generated_sources}
  28. PROTO_FILES ${proto_files}
  29. )