CMakeLists.txt 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. set(TARGET simplechat)
  2. set(CMAKE_INCLUDE_CURRENT_DIR ON)
  3. set(CMAKE_AUTOMOC ON)
  4. set(CMAKE_AUTORCC ON)
  5. find_package(Qt5 COMPONENTS Core Quick Network REQUIRED)
  6. find_package(QtProtobufProject CONFIG REQUIRED COMPONENTS QtProtobuf QtGrpc)
  7. set(GENERATED_HEADERS
  8. chatmessage.h
  9. chatmessages.h
  10. user.h
  11. users.h
  12. none.h
  13. simplechatclient.h)
  14. file(GLOB PROTO_FILES ABSOLUTE ${CMAKE_CURRENT_SOURCE_DIR}/proto/simplechat.proto)
  15. generate_qtprotobuf(TARGET ${TARGET}
  16. OUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/generated
  17. PROTO_FILES ${PROTO_FILES}
  18. GENERATED_HEADERS ${GENERATED_HEADERS})
  19. file(GLOB SOURCES main.cpp
  20. simplechatengine.cpp
  21. )
  22. file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../simplechatserver/cert.pem DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
  23. add_executable(${TARGET} ${SOURCES} resources.qrc)
  24. add_dependencies(${TARGET} ${QtProtobuf_GENERATED} examples_common)
  25. target_include_directories(${TARGET} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/generated)
  26. target_link_libraries(${TARGET} examples_common QtProtobufProject::QtProtobuf QtProtobufProject::QtGrpc ${QtProtobuf_GENERATED} Qt5::Quick Qt5::Qml)