CMakeLists.txt 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. set(TARGET qtprotobuf_qml_test)
  2. qt_protobuf_internal_find_dependencies()
  3. set(CMAKE_AUTOMOC OFF)
  4. file(GLOB SOURCES main.cpp)
  5. file(GLOB QML_FILES qml/tst_simple.qml)
  6. qt5_wrap_cpp(MOC_SOURCES test.h)
  7. add_executable(${TARGET} ${MOC_SOURCES} ${SOURCES} ${QML_FILES})
  8. target_link_libraries(${TARGET} PRIVATE Qt5::Core Qt5::Qml Qt5::Network Qt5::Quick Qt5::Test Qt5::QuickTest ${QT_PROTOBUF_NAMESPACE}::Protobuf)
  9. if(TARGET ${QT_PROTOBUF_NAMESPACE}::ProtobufWellKnownTypes)
  10. target_link_libraries(${TARGET} PRIVATE ${QT_PROTOBUF_NAMESPACE}::ProtobufWellKnownTypes)
  11. endif()
  12. if(QT_PROTOBUF_STATIC)
  13. target_link_libraries(${TARGET} PRIVATE ${PROTOBUF_QUICK_PLUGIN_NAME})
  14. endif()
  15. qtprotobuf_link_target(${TARGET} qtprotobuf_test_qtprotobuf_gen)
  16. qt_protobuf_internal_add_target_qml(TARGET ${TARGET} QML_FILES ${QML_FILES})
  17. qt_protobuf_internal_add_target_windeployqt(TARGET ${TARGET} QML_DIR ${CMAKE_CURRENT_SOURCE_DIR}/qml)
  18. add_test(NAME ${TARGET} COMMAND ${TARGET})
  19. set_tests_properties(${TARGET} PROPERTIES
  20. ENVIRONMENT QML2_IMPORT_PATH=$<TARGET_FILE_DIR:${PROTOBUF_QUICK_PLUGIN_NAME}>/..)