cmake_minimum_required(VERSION 3.16) project(grpcsimplechat LANGUAGES CXX) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOUIC ON) if(NOT DEFINED INSTALL_EXAMPLESDIR) set(INSTALL_EXAMPLESDIR "examples") endif() set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/grpc/grpcsimplechat") find_package(Qt6 REQUIRED COMPONENTS Core Quick Protobuf Grpc) qt_add_executable(grpcsimplechat main.cpp simplechatengine.cpp simplechatengine.h ../examples_common/universallistmodel.cpp ../examples_common/universallistmodel.h ../examples_common/universallistmodelbase.cpp ../examples_common/universallistmodel.h ) target_include_directories(grpcsimplechat PRIVATE ../examples_common) target_link_libraries(grpcsimplechat PRIVATE Qt::Core Qt::Quick Qt::Protobuf Qt::Grpc Qt::Quick ) qt_add_qml_module(grpcsimplechat URI examples.grpc.simplechat VERSION 1.0 QML_FILES ChatInputField.qml ChatView.qml main.qml RESOURCES img/arrow.png NO_RESOURCE_TARGET_PATH ) qt_protobuf_generate(TARGET grpcsimplechat PROTO_FILES proto/simplechat.proto QML ) install(TARGETS grpcsimplechat RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" ) add_custom_command(TARGET grpcsimplechat COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/../ssl/cert.pem" "$" ) install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../ssl/cert.pem" DESTINATION "${INSTALL_EXAMPLEDIR}" )