CMakeLists.txt 1.1 KB

123456789101112131415161718192021222324252627
  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(${QT_PROTOBUF_CMAKE_DIR}/QtProtobufTest.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} PRIVATE Qt5::Core Qt5::Qml Qt5::Network Qt5::Quick Qt5::Test Qt5::QuickTest QtProtobufProject::QtProtobuf)
  9. if(TARGET QtProtobufProject::QtProtobufWellKnownTypes)
  10. target_link_libraries(${TARGET} PRIVATE QtProtobufProject::QtProtobufWellKnownTypes)
  11. endif()
  12. target_sources(${TARGET} PRIVATE $<TARGET_OBJECTS:qtprotobuf_test_qtprotobuf_gen>)
  13. target_include_directories(${TARGET} PRIVATE $<TARGET_PROPERTY:qtprotobuf_test_qtprotobuf_gen,INTERFACE_INCLUDE_DIRECTORIES>)
  14. add_target_qml(TARGET ${TARGET} QML_FILES ${QML_FILES})
  15. add_target_windeployqt(TARGET ${TARGET} QML_DIR ${CMAKE_CURRENT_SOURCE_DIR}/qml)
  16. add_test(NAME ${TARGET} COMMAND ${TARGET})
  17. set_tests_properties(${TARGET} PROPERTIES
  18. ENVIRONMENT QML2_IMPORT_PATH=$<TARGET_FILE_DIR:protobufquickplugin>/..)