CMakeLists.txt 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. set(GENERATED_HEADERS
  8. addressbookclient.h
  9. address.h
  10. contact.h
  11. contacts.h
  12. globalenums.h
  13. job.h
  14. listframe.h
  15. phonenumber.h
  16. none.h
  17. callstatus.h)
  18. file(GLOB PROTO_FILES ABSOLUTE ${CMAKE_CURRENT_SOURCE_DIR}/proto/addressbook.proto)
  19. generate_qtprotobuf(TARGET ${TARGET}
  20. OUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/generated
  21. PROTO_FILES ${PROTO_FILES}
  22. GENERATED_HEADERS ${GENERATED_HEADERS})
  23. file(GLOB SOURCES main.cpp
  24. addressbookengine.cpp)
  25. file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../addressbookserver/cert.pem DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
  26. add_executable(${TARGET} ${SOURCES} resources.qrc)
  27. add_dependencies(${TARGET} ${QtProtobuf_GENERATED} examples_common)
  28. target_include_directories(${TARGET} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/generated)
  29. target_link_libraries(${TARGET} examples_common QtProtobufProject::QtProtobuf QtProtobufProject::QtGrpc ${QtProtobuf_GENERATED} Qt5::Quick Qt5::Qml)
  30. set(CLIENT_EXEC_PATH ${CMAKE_CURRENT_BINARY_DIR}/${TARGET} PARENT_SCOPE)