diff options
author | Oliver Eftevaag <oliver.eftevaag@qt.io> | 2022-09-22 15:53:13 +0200 |
---|---|---|
committer | Oliver Eftevaag <oliver.eftevaag@qt.io> | 2022-09-26 00:16:57 +0200 |
commit | 5663b772e02758a0c1f45a556061b25c68796da5 (patch) | |
tree | 98b5dec37fbc512ea772f17487a2d701062dae1b /examples | |
parent | fa00dee21ccd6f7ec159a8d88756df6e778b8d32 (diff) |
Flatstyle example: use qt_add_qml_module() in CMakeLists.txt
qt_add_qml_module() should be used instead of qt_add_resources() for
adding resources to examples in qtdeclarative.
Task-number: QTBUG-98130
Pick-to: 6.2 6.4
Change-Id: I41adae7f861f6cbcc13a735a43e8b5dd3ec31934
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/quickcontrols2/flatstyle/CMakeLists.txt | 44 |
1 files changed, 18 insertions, 26 deletions
diff --git a/examples/quickcontrols2/flatstyle/CMakeLists.txt b/examples/quickcontrols2/flatstyle/CMakeLists.txt index f75bea25c9..7ddb17c99b 100644 --- a/examples/quickcontrols2/flatstyle/CMakeLists.txt +++ b/examples/quickcontrols2/flatstyle/CMakeLists.txt @@ -14,16 +14,28 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quickcontrols2/flatstyle") find_package(Qt6 REQUIRED COMPONENTS Core Gui Quick QuickControls2 Widgets) -qt_add_executable(flatstyle +qt_add_executable(flatstyleexample WIN32 MACOSX_BUNDLE main.cpp ) -set_target_properties(flatstyle PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE +qt_add_qml_module(flatstyleexample + URI flatstyle + VERSION 1.0 + NO_RESOURCE_TARGET_PATH + QML_FILES + "MainForm.ui.qml" + "flatstyle.qml" + "imports/Flat/Button.qml" + "imports/Flat/CheckBox.qml" + "imports/Flat/Switch.qml" + "imports/Theme/Theme.qml" + RESOURCES + "imports/Flat/qmldir" + "imports/Theme/qmldir" + "qtquickcontrols2.conf" ) -target_link_libraries(flatstyle PUBLIC +target_link_libraries(flatstyleexample PUBLIC Qt::Core Qt::Gui Qt::Quick @@ -31,27 +43,7 @@ target_link_libraries(flatstyle PUBLIC Qt::Widgets ) -# Resources: -set(qmake_immediate_resource_files - "MainForm.ui.qml" - "flatstyle.qml" - "imports/Flat/Button.qml" - "imports/Flat/CheckBox.qml" - "imports/Flat/Switch.qml" - "imports/Flat/qmldir" - "imports/Theme/Theme.qml" - "imports/Theme/qmldir" - "qtquickcontrols2.conf" -) - -qt6_add_resources(flatstyle "qmake_immediate" - PREFIX - "/" - FILES - ${qmake_immediate_resource_files} -) - -install(TARGETS flatstyle +install(TARGETS flatstyleexample RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" |