CMakeLists.txt 1009 B

12345678910111213141516171819202122232425262728
  1. set(TARGET addressbook)
  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/addressbook.proto)
  8. file(GLOB SOURCES main.cpp
  9. addressbookengine.cpp)
  10. add_executable(${TARGET} ${SOURCES} resources.qrc)
  11. qtprotobuf_generate(TARGET ${TARGET}
  12. OUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/generated
  13. PROTO_FILES ${PROTO_FILES}
  14. QML)
  15. add_target_windeployqt(TARGET ${TARGET} QML_DIR ${CMAKE_CURRENT_SOURCE_DIR}/qml)
  16. add_custom_command(TARGET ${TARGET}
  17. COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/../addressbookserver/cert.pem $<TARGET_FILE_DIR:${TARGET}>)
  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)