CMakeLists.txt 908 B

1234567891011121314151617181920212223
  1. set(TARGET qtprotobuf_qml_test)
  2. find_package(Qt5 COMPONENTS Core Quick Network Test QuickTest REQUIRED)
  3. find_package(QtProtobufProject COMPONENTS QtProtobuf REQUIRED)
  4. include(${QTPROTOBUF_CMAKE_DIR}/QtProtobufCommon.cmake)
  5. file(GLOB SOURCES main.cpp)
  6. file(GLOB QML_FILES qml/tst_simple.qml)
  7. add_executable(${TARGET} ${SOURCES} ${QML_FILES})
  8. target_link_libraries(${TARGET} Qt5::Core Qt5::Qml Qt5::Network Qt5::Quick Qt5::Test Qt5::QuickTest QtProtobufProject::QtProtobuf)
  9. qtprotobuf_link_archive(${TARGET} qtprotobuf_test_qtprotobuf_gen)
  10. add_target_qml(TARGET ${TARGET} QML_FILES ${QML_FILES})
  11. add_target_windeployqt(TARGET ${TARGET} QML_DIR ${CMAKE_CURRENT_SOURCE_DIR}/qml)
  12. add_test(NAME ${TARGET} COMMAND ${TARGET})
  13. set(QTPROTOBUF_QML2_IMPORT_PATH $<TARGET_FILE_DIR:protobufquickplugin>/..)
  14. set_tests_properties(${TARGET} PROPERTIES
  15. ENVIRONMENT QML2_IMPORT_PATH=${QTPROTOBUF_QML2_IMPORT_PATH})