CMakeLists.txt 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. set(TARGET extra_namespace_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_extra_namespace.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(QT_PROTOBUF_STATIC)
  10. target_link_libraries(${TARGET} PRIVATE ${PROTOBUF_QUICK_PLUGIN_NAME})
  11. endif()
  12. qtprotobuf_link_target(${TARGET} qtprotobuf_extranamespace_test_qtprotobuf_gen)
  13. qt_protobuf_internal_add_target_qml(TARGET ${TARGET} QML_FILES ${QML_FILES})
  14. qt_protobuf_internal_add_target_windeployqt(TARGET ${TARGET} QML_DIR ${CMAKE_CURRENT_SOURCE_DIR}/qml)
  15. add_test(NAME ${TARGET} COMMAND ${TARGET})
  16. if(NOT QT_PROTOBUF_STATIC AND NOT QT_PROTOBUF_STANDALONE_TESTS)
  17. set(path_separator ":")
  18. if(WIN32)
  19. set(path_separator "$<SEMICOLON>")
  20. endif()
  21. set_tests_properties(${TARGET} PROPERTIES
  22. ENVIRONMENT "QML2_IMPORT_PATH=$ENV{QML2_IMPORT_PATH}${path_separator}\
  23. $<TARGET_FILE_DIR:${QT_PROTOBUF_NAMESPACE}::${PROTOBUF_QUICK_PLUGIN_NAME}>/.."
  24. )
  25. endif()