CMakeLists.txt 1.0 KB

123456789101112131415161718192021
  1. set(TARGET secureechoserver)
  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} PRIVATE gRPC::grpc++ protobuf::libprotobuf)
  10. target_include_directories(${TARGET} PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
  11. if(MSVC)
  12. target_compile_definitions(${TARGET} PRIVATE _WIN32_WINNT=0x600 _SCL_SECURE_NO_WARNINGS _CRT_SECURE_NO_WARNINGS _WINSOCK_DEPRECATED_NO_WARNINGS)
  13. endif()
  14. file(GLOB PROTO_FILES ABSOLUTE ${CMAKE_CURRENT_SOURCE_DIR}/../proto/*.proto)
  15. qt_internal_protobuf_reference_generate(TARGET ${TARGET}
  16. GENERATED_SOURCES ${GENERATED_SOURCES}
  17. PROTO_FILES ${PROTO_FILES})
  18. file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/cert.pem ${CMAKE_CURRENT_SOURCE_DIR}/key.pem DESTINATION ${CMAKE_CURRENT_BINARY_DIR})