CMakeLists.txt 998 B

12345678910111213141516171819202122
  1. set(TARGET addressbookserver)
  2. include(${CMAKE_SOURCE_DIR}/cmake/QtProtobufCommon.cmake)
  3. set(GENERATED_SOURCES
  4. ${CMAKE_CURRENT_BINARY_DIR}/addressbook.pb.cc
  5. ${CMAKE_CURRENT_BINARY_DIR}/addressbook.grpc.pb.cc)
  6. set_source_files_properties(${GENERATED_SOURCES} PROPERTIES GENERATED TRUE)
  7. add_executable(${TARGET} main.cpp ${GENERATED_SOURCES})
  8. target_include_directories(${TARGET} PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
  9. file(GLOB PROTO_FILES ABSOLUTE ${CMAKE_CURRENT_SOURCE_DIR}/../addressbook/proto/*.proto)
  10. protobuf_generate_all(TARGET ${TARGET}
  11. GENERATED_SOURCES ${GENERATED_SOURCES}
  12. PROTO_FILES ${PROTO_FILES})
  13. target_link_libraries(${TARGET} protobuf::libprotobuf gRPC::grpc++ gRPC::grpc)
  14. if(MSVC)
  15. target_compile_definitions(${TARGET} PRIVATE _WIN32_WINNT=0x600 _SCL_SECURE_NO_WARNINGS _CRT_SECURE_NO_WARNINGS _WINSOCK_DEPRECATED_NO_WARNINGS)
  16. endif()
  17. file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/cert.pem ${CMAKE_CURRENT_SOURCE_DIR}/key.pem DESTINATION ${CMAKE_CURRENT_BINARY_DIR})