CMakeLists.txt 1.0 KB

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