CMakeLists.txt 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. qt_find_package(gRPC CONFIG)
  2. qt_find_package(Protobuf CONFIG)
  3. unset(extra_generator_args)
  4. if(TARGET Qt::Qml)
  5. list(APPEND extra_generator_args QML)
  6. endif()
  7. # gRPC tests require reference gRPC and protobuf implementation
  8. if(NOT TARGET gRPC::grpc_cpp_plugin
  9. OR NOT TARGET gRPC::grpc++
  10. OR NOT TARGET protobuf::libprotobuf
  11. OR NOT TARGET protobuf::protoc)
  12. message(AUTHOR_WARNING "QtGrpc tests require the reference gRPC C++ libraries.")
  13. return ()
  14. endif()
  15. qt_protobuf_generate(GENERATED_TARGET tst_grpc_tests_common_gen
  16. PROTO_FILES
  17. proto/simpletest.proto
  18. proto/testservice.proto
  19. ${extra_generator_args}
  20. )
  21. add_subdirectory(echoserver)
  22. qt_internal_add_test(tst_grpc_client_basic
  23. SOURCES
  24. clienttest.cpp
  25. LIBRARIES
  26. Qt::Grpc
  27. Qt::Protobuf
  28. DEFINES
  29. QT_GRPC_SERVER_EXECUTABLE=\"$<TARGET_FILE:echoserver>\"
  30. )
  31. _qt_internal_link_protobuf_objects(tst_grpc_client_basic tst_grpc_tests_common_gen)
  32. if(TARGET Qt::QuickTest)
  33. add_subdirectory(qml)
  34. endif()
  35. # TODO Qt6: Enable secure connection test later
  36. #add_subdirectory(secureechoserver)
  37. #qt_internal_add_test(grpc_client_secure
  38. # SOURCES
  39. # sslclienttest.cpp
  40. # LIBRARIES
  41. # Qt::Grpc
  42. # Qt::Protobuf
  43. # DEFINES
  44. # QT_GRPC_SERVER_EXECUTABLE=\"$<TARGET_FILE:secureechoserver>\"
  45. #)
  46. #_qt_internal_link_protobuf_objects(grpc_client_secure grpc_tests_common_gen)