CMakeLists.txt 950 B

12345678910111213141516171819202122232425262728
  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. file(GLOB PROTO_FILES ABSOLUTE ${CMAKE_CURRENT_SOURCE_DIR}/proto/simplechat.proto)
  8. file(GLOB SOURCES main.cpp
  9. simplechatengine.cpp
  10. )
  11. file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../simplechatserver/cert.pem DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
  12. add_executable(${TARGET} ${SOURCES} resources.qrc)
  13. qtprotobuf_generate(TARGET ${TARGET}
  14. OUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/generated
  15. PROTO_FILES ${PROTO_FILES}
  16. QML)
  17. add_target_windeployqt(TARGET ${TARGET} QML_DIR ${CMAKE_CURRENT_SOURCE_DIR})
  18. target_link_libraries(${TARGET} PRIVATE examples_common QtProtobufProject::QtProtobuf QtProtobufProject::QtGrpc Qt5::Quick Qt5::Qml)
  19. set(CLIENT_EXEC_PATH ${CMAKE_CURRENT_BINARY_DIR}/${TARGET} PARENT_SCOPE)