diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2021-08-31 14:59:05 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2021-09-06 11:03:09 +0200 |
commit | 79cae5f6522bc259caa27b98031bfe84ef936744 (patch) | |
tree | d084a801227c98457777483e911e4d570c20af4a /examples/quick/customitems/painteditem/CMakeLists.txt | |
parent | 485416c9d57e8ff8fe4fc0f7f4a3c4fdeaf35e98 (diff) |
Clean up the painteditem example
The way it was before it was unusable. Move the files that belong to the
TextBalloon module into their own directory, and add a wrapper
application that loads textballoons.qml with the right parameters to
actually find the TextBalloon module. Make sure that the qmldir file is
copied to the output directory.
Pick-to: 6.2
Change-Id: Ie7407a425a0a95a46de6486f9a28fd1aee07de9f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'examples/quick/customitems/painteditem/CMakeLists.txt')
-rw-r--r-- | examples/quick/customitems/painteditem/CMakeLists.txt | 53 |
1 files changed, 14 insertions, 39 deletions
diff --git a/examples/quick/customitems/painteditem/CMakeLists.txt b/examples/quick/customitems/painteditem/CMakeLists.txt index 9094dfe695..63becfa53d 100644 --- a/examples/quick/customitems/painteditem/CMakeLists.txt +++ b/examples/quick/customitems/painteditem/CMakeLists.txt @@ -1,62 +1,37 @@ -# Generated from painteditem.pro. - cmake_minimum_required(VERSION 3.16) -project(qmltextballoonplugin LANGUAGES CXX) +project(painteditem LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) - set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTORCC ON) -set(CMAKE_AUTOUIC ON) if(NOT DEFINED INSTALL_EXAMPLESDIR) set(INSTALL_EXAMPLESDIR "examples") endif() -set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/customitems/painteditem/TextBalloonPlugin") -set(QT_QML_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/examples/quick/customitems/painteditem) +set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/customitems/painteditem") + +find_package(Qt6 COMPONENTS Core Gui Quick Qml) -find_package(Qt6 COMPONENTS Core) -find_package(Qt6 COMPONENTS Gui) -find_package(Qt6 COMPONENTS Qml) -find_package(Qt6 COMPONENTS Quick) +add_subdirectory(TextBalloon) -qt6_add_qml_module(qmltextballoonplugin +qt_add_executable(painteditemexample WIN32 MACOSX_BUNDLE main.cpp) + +qt_add_qml_module(painteditemexample + URI painteditem VERSION 1.0 - URI "TextBalloonPlugin" - PLUGIN_TARGET qmltextballoonplugin - QML_FILES textballoons.qml - RESOURCE_PREFIX "/painteditem" + QML_FILES + "textballoons.qml" ) -target_sources(qmltextballoonplugin PRIVATE - textballoon.cpp textballoon.h -) -set_target_properties(qmltextballoonplugin PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE -) -target_link_libraries(qmltextballoonplugin PUBLIC +target_link_libraries(painteditemexample PRIVATE Qt::Core Qt::Gui Qt::Qml Qt::Quick + qmltextballoon ) - -# Resources: -set(painteditem_resource_files - "textballoon.h" -) - -qt6_add_resources(qmltextballoonplugin "painteditem" - PREFIX - "/painteditem" - FILES - ${painteditem_resource_files} -) - -install(TARGETS qmltextballoonplugin +install(TARGETS painteditemexample RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" |