diff options
author | Oliver Eftevaag <oliver.eftevaag@qt.io> | 2022-09-22 12:43:50 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-09-27 08:37:14 +0000 |
commit | b636da7999b01e4c9270dc6ab48d50a05b85d17b (patch) | |
tree | 7a838d3434e158a6e96147182cfdfc2d0d8153a2 /examples/quickcontrols2/texteditor/CMakeLists.txt | |
parent | 8ae1141fe8d93fe175fc0cb51ef180c1a0f80d46 (diff) |
TextEditor example: use qt_add_qml_module in CMakeLists.txt
Our examples should use qt_add_qml_module when possible.
Task-number: QTBUG-98130
Change-Id: I9f5946bf287734aab52c08691d6e38910de0e410
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit 316310158bb51edbe813f15742b165b0e69c95ab)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'examples/quickcontrols2/texteditor/CMakeLists.txt')
-rw-r--r-- | examples/quickcontrols2/texteditor/CMakeLists.txt | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/examples/quickcontrols2/texteditor/CMakeLists.txt b/examples/quickcontrols2/texteditor/CMakeLists.txt index f8e41b4f0c..82bf3c31cf 100644 --- a/examples/quickcontrols2/texteditor/CMakeLists.txt +++ b/examples/quickcontrols2/texteditor/CMakeLists.txt @@ -11,48 +11,45 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quickcontrols2/texteditor") find_package(Qt6 REQUIRED COMPONENTS Core Gui Quick QuickControls2 OPTIONAL_COMPONENTS Widgets) -qt_add_executable(texteditor WIN32 MACOSX_BUNDLE +qt_add_executable(texteditorexample WIN32 MACOSX_BUNDLE documenthandler.cpp texteditor.cpp ) -target_link_libraries(texteditor PUBLIC +qt_add_qml_module(texteditorexample + URI texteditor + VERSION 1.0 + NO_RESOURCE_TARGET_PATH + QML_FILES + "qml/+touch/texteditor.qml" + "qml/texteditor.qml" + RESOURCES + "texteditor.html" + "+touch/texteditor.html" + "fonts/fontello.ttf" + "images/qt-logo.png" +) + +target_link_libraries(texteditorexample PUBLIC Qt::Core Qt::Gui Qt::Quick Qt::QuickControls2 ) -# Resources: -set(texteditor_resource_files - "+touch/texteditor.html" - "fonts/fontello.ttf" - "images/qt-logo.png" - "qml/+touch/texteditor.qml" - "qml/texteditor.qml" - "texteditor.html" -) - -qt6_add_resources(texteditor "texteditor" - PREFIX - "/" - FILES - ${texteditor_resource_files} -) - if(TARGET Qt::Widgets) - target_link_libraries(texteditor PUBLIC + target_link_libraries(texteditorexample PUBLIC Qt::Widgets ) endif() if(CMAKE_CROSSCOMPILING) - target_compile_definitions(texteditor PUBLIC + target_compile_definitions(texteditorexample PUBLIC QT_EXTRA_FILE_SELECTOR="touch" ) endif() -install(TARGETS texteditor +install(TARGETS texteditorexample RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" |