summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2024-03-25 19:28:28 +0100
committerAlexandru Croitor <alexandru.croitor@qt.io>2024-05-13 09:44:04 +0200
commitcde9cfb96c07ab26926f0fb1f97c2550353f05b3 (patch)
treee49ab206e81bb286857114e6c47351090c3880e0
parentb8232a7adb7f68905739290b0b09fc2f62d0d86e (diff)
CMake: Add deployment API to our examples
Projects were modified using the tool at: https://git.qt.io/alcroito/cmake_refactor Some examples had to be adapted manually, mostly those that build additional qml modules / plugins. documentviewer did not get the deployment api, because it's trickier. Pick-to: 6.7 Task-number: QTBUG-101340 Task-number: QTBUG-102056 Task-number: QTBUG-102057 Change-Id: I76322185fc824c112d77e077ee39e7ccbc193a4c Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
-rw-r--r--examples/demos/FX_Material_Showroom/CMakeLists.txt21
-rw-r--r--examples/demos/calqlatr/CMakeLists.txt21
-rw-r--r--examples/demos/car-configurator/CMakeLists.txt21
-rw-r--r--examples/demos/clocks/CMakeLists.txt21
-rw-r--r--examples/demos/coffee/CMakeLists.txt21
-rw-r--r--examples/demos/colorpaletteclient/CMakeLists.txt22
-rw-r--r--examples/demos/colorpaletteclient/QtBundleQmlModuleForMacOS.cmake35
-rw-r--r--examples/demos/colorpaletteclient/QtExampleStyle/CMakeLists.txt13
-rw-r--r--examples/demos/dice/CMakeLists.txt21
-rw-r--r--examples/demos/documentviewer/CMakeLists.txt6
-rw-r--r--examples/demos/documentviewer/app/CMakeLists.txt12
-rw-r--r--examples/demos/documentviewer/plugins/jsonviewer/CMakeLists.txt12
-rw-r--r--examples/demos/documentviewer/plugins/pdfviewer/CMakeLists.txt12
-rw-r--r--examples/demos/documentviewer/plugins/q3dviewer/CMakeLists.txt12
-rw-r--r--examples/demos/documentviewer/plugins/txtviewer/CMakeLists.txt12
-rw-r--r--examples/demos/hangman/CMakeLists.txt20
-rw-r--r--examples/demos/lightningviewer/CMakeLists.txt21
-rw-r--r--examples/demos/lightningviewer/LightningViewer/CMakeLists.txt8
-rw-r--r--examples/demos/lightningviewer/LightningViewerStyle/CMakeLists.txt8
-rw-r--r--examples/demos/maroon/CMakeLists.txt21
-rw-r--r--examples/demos/mediaplayer/CMakeLists.txt21
-rw-r--r--examples/demos/osmbuildings/CMakeLists.txt21
-rw-r--r--examples/demos/photosurface/CMakeLists.txt21
-rw-r--r--examples/demos/robotarm/CMakeLists.txt21
-rw-r--r--examples/demos/rssnews/CMakeLists.txt21
-rw-r--r--examples/demos/samegame/CMakeLists.txt21
-rw-r--r--examples/demos/stocqt/CMakeLists.txt28
-rw-r--r--examples/demos/thermostat/CMakeLists.txt17
-rw-r--r--examples/demos/todolist/CMakeLists.txt17
-rw-r--r--examples/tutorials/alarms/CMakeLists.txt21
30 files changed, 305 insertions, 244 deletions
diff --git a/examples/demos/FX_Material_Showroom/CMakeLists.txt b/examples/demos/FX_Material_Showroom/CMakeLists.txt
index affa69b9b..1d364d9a6 100644
--- a/examples/demos/FX_Material_Showroom/CMakeLists.txt
+++ b/examples/demos/FX_Material_Showroom/CMakeLists.txt
@@ -5,12 +5,6 @@ project(FxMaterialShowroomApp LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/demos/${PROJECT_NAME}")
-
find_package(Qt6 6.5 REQUIRED COMPONENTS Gui Qml Quick Quick3D)
qt_standard_project_setup(REQUIRES 6.5)
@@ -38,7 +32,16 @@ target_link_libraries(FxMaterialShowroomApp PRIVATE
include(qmlmodules)
install(TARGETS FxMaterialShowroomApp
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION .
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+)
+
+qt_generate_deploy_qml_app_script(
+ TARGET FxMaterialShowroomApp
+ OUTPUT_SCRIPT deploy_script
+ MACOS_BUNDLE_POST_BUILD
+ NO_UNSUPPORTED_PLATFORM_ERROR
+ DEPLOY_USER_QML_MODULES_ON_UNSUPPORTED_PLATFORM
)
+install(SCRIPT ${deploy_script})
diff --git a/examples/demos/calqlatr/CMakeLists.txt b/examples/demos/calqlatr/CMakeLists.txt
index 9df94e7a3..3a4d425b4 100644
--- a/examples/demos/calqlatr/CMakeLists.txt
+++ b/examples/demos/calqlatr/CMakeLists.txt
@@ -4,12 +4,6 @@
cmake_minimum_required(VERSION 3.16)
project(calqlatr LANGUAGES CXX)
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/demos/calqlatr")
-
find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick QuickControls2)
qt_standard_project_setup(REQUIRES 6.5)
@@ -55,7 +49,16 @@ if(IOS)
endif()
install(TARGETS calqlatrexample
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION .
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+)
+
+qt_generate_deploy_qml_app_script(
+ TARGET calqlatrexample
+ OUTPUT_SCRIPT deploy_script
+ MACOS_BUNDLE_POST_BUILD
+ NO_UNSUPPORTED_PLATFORM_ERROR
+ DEPLOY_USER_QML_MODULES_ON_UNSUPPORTED_PLATFORM
)
+install(SCRIPT ${deploy_script})
diff --git a/examples/demos/car-configurator/CMakeLists.txt b/examples/demos/car-configurator/CMakeLists.txt
index f4e9dbc76..e34ef4c90 100644
--- a/examples/demos/car-configurator/CMakeLists.txt
+++ b/examples/demos/car-configurator/CMakeLists.txt
@@ -2,12 +2,6 @@ cmake_minimum_required(VERSION 3.21.1)
project(CarRenderingApp LANGUAGES CXX)
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/demos/${PROJECT_NAME}")
-
find_package(Qt6 6.6 REQUIRED COMPONENTS
Core
Gui
@@ -45,7 +39,16 @@ target_link_libraries(CarRenderingApp PRIVATE
include(${CMAKE_CURRENT_SOURCE_DIR}/qmlmodules.cmake)
install(TARGETS CarRenderingApp
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION .
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+)
+
+qt_generate_deploy_qml_app_script(
+ TARGET CarRenderingApp
+ OUTPUT_SCRIPT deploy_script
+ MACOS_BUNDLE_POST_BUILD
+ NO_UNSUPPORTED_PLATFORM_ERROR
+ DEPLOY_USER_QML_MODULES_ON_UNSUPPORTED_PLATFORM
)
+install(SCRIPT ${deploy_script})
diff --git a/examples/demos/clocks/CMakeLists.txt b/examples/demos/clocks/CMakeLists.txt
index 85778c16e..de6692ad9 100644
--- a/examples/demos/clocks/CMakeLists.txt
+++ b/examples/demos/clocks/CMakeLists.txt
@@ -6,12 +6,6 @@ project(clocks LANGUAGES CXX)
set(CMAKE_AUTOMOC ON)
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/demos/clocks")
-
find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick)
qt_add_executable(clocks
@@ -53,7 +47,16 @@ qt_add_resources(clocks "clocks"
)
install(TARGETS clocks
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION .
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+)
+
+qt_generate_deploy_qml_app_script(
+ TARGET clocks
+ OUTPUT_SCRIPT deploy_script
+ MACOS_BUNDLE_POST_BUILD
+ NO_UNSUPPORTED_PLATFORM_ERROR
+ DEPLOY_USER_QML_MODULES_ON_UNSUPPORTED_PLATFORM
)
+install(SCRIPT ${deploy_script})
diff --git a/examples/demos/coffee/CMakeLists.txt b/examples/demos/coffee/CMakeLists.txt
index db9cf6f6e..0fa892745 100644
--- a/examples/demos/coffee/CMakeLists.txt
+++ b/examples/demos/coffee/CMakeLists.txt
@@ -4,12 +4,6 @@
cmake_minimum_required(VERSION 3.16)
project(coffee LANGUAGES CXX)
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}")
-
find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick)
qt_standard_project_setup(REQUIRES 6.6)
@@ -101,7 +95,16 @@ target_link_libraries(coffeemachine PRIVATE
)
install(TARGETS coffeemachine
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION .
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+)
+
+qt_generate_deploy_qml_app_script(
+ TARGET coffeemachine
+ OUTPUT_SCRIPT deploy_script
+ MACOS_BUNDLE_POST_BUILD
+ NO_UNSUPPORTED_PLATFORM_ERROR
+ DEPLOY_USER_QML_MODULES_ON_UNSUPPORTED_PLATFORM
)
+install(SCRIPT ${deploy_script})
diff --git a/examples/demos/colorpaletteclient/CMakeLists.txt b/examples/demos/colorpaletteclient/CMakeLists.txt
index 27dfb3105..39bccbe47 100644
--- a/examples/demos/colorpaletteclient/CMakeLists.txt
+++ b/examples/demos/colorpaletteclient/CMakeLists.txt
@@ -4,12 +4,6 @@
cmake_minimum_required(VERSION 3.16)
project(colorpaletteclient LANGUAGES CXX)
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/demos/${PROJECT_NAME}")
-
find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick)
qt_standard_project_setup(REQUIRES 6.6)
@@ -62,10 +56,16 @@ target_link_libraries(colorpaletteclient PRIVATE
)
install(TARGETS colorpaletteclient
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION .
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
-include(QtBundleQmlModuleForMacOS.cmake)
-add_qml_module_to_macos_app_bundle("colorpaletteclient" "qtexamplestyle")
+qt_generate_deploy_qml_app_script(
+ TARGET colorpaletteclient
+ OUTPUT_SCRIPT deploy_script
+ MACOS_BUNDLE_POST_BUILD
+ NO_UNSUPPORTED_PLATFORM_ERROR
+ DEPLOY_USER_QML_MODULES_ON_UNSUPPORTED_PLATFORM
+)
+install(SCRIPT ${deploy_script})
diff --git a/examples/demos/colorpaletteclient/QtBundleQmlModuleForMacOS.cmake b/examples/demos/colorpaletteclient/QtBundleQmlModuleForMacOS.cmake
deleted file mode 100644
index 48ac398bb..000000000
--- a/examples/demos/colorpaletteclient/QtBundleQmlModuleForMacOS.cmake
+++ /dev/null
@@ -1,35 +0,0 @@
-# Copyright (C) 2024 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-function(add_qml_module_to_macos_app_bundle app_target qml_module)
- if(QT6_IS_SHARED_LIBS_BUILD AND APPLE)
- # The application's main.cpp adds an explicit QML import path to look for qml module plugins
- # under a PlugIns subdirectory of a macOS app bundle.
- # Copy the qmldir and shared library qml plugin.
-
- qt6_query_qml_module(${qml_module}
- QMLDIR qmldir_file
- PLUGIN_TARGET qml_plugin_target
- URI qml_module_uri
- )
-
- # Ensure the executable depends on the plugin so the plugin is copied
- # only after it was built.
- add_dependencies(${app_target} ${qml_plugin_target})
-
- set(app_dir "$<TARGET_FILE_DIR:${app_target}>")
-
- string(REGEX REPLACE "[^A-Za-z0-9]" "_" escaped_uri "${qml_module_uri}")
-
- set(dest_module_dir_in_app_bundle "${app_dir}/../PlugIns/${escaped_uri}")
-
- add_custom_command(TARGET ${app_target} POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E make_directory ${dest_module_dir_in_app_bundle}
- COMMAND ${CMAKE_COMMAND} -E copy_if_different
- $<TARGET_FILE:${qml_plugin_target}> ${dest_module_dir_in_app_bundle}
- COMMAND ${CMAKE_COMMAND} -E copy_if_different
- ${qmldir_file} ${dest_module_dir_in_app_bundle}
- )
- endif()
-endfunction()
-
diff --git a/examples/demos/colorpaletteclient/QtExampleStyle/CMakeLists.txt b/examples/demos/colorpaletteclient/QtExampleStyle/CMakeLists.txt
index 36256d8e7..db6836617 100644
--- a/examples/demos/colorpaletteclient/QtExampleStyle/CMakeLists.txt
+++ b/examples/demos/colorpaletteclient/QtExampleStyle/CMakeLists.txt
@@ -6,12 +6,6 @@ project(qtexamplestyle LANGUAGES CXX)
set(CMAKE_AUTOMOC ON)
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quickcontrols/colorpaletteclient/QtExampleStyle")
-
find_package(Qt6 REQUIRED COMPONENTS Core Gui Quick QuickControls2)
set_source_files_properties(UIStyle.qml
@@ -45,10 +39,9 @@ if(UNIX AND NOT APPLE AND CMAKE_CROSSCOMPILING)
endif()
install(TARGETS qtexamplestyle
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}/QtExampleStyle"
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/QtExampleStyle"
)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/qmldir
- DESTINATION "${INSTALL_EXAMPLEDIR}"
+ DESTINATION "${CMAKE_INSTALL_BINDIR}/QtExampleStyle"
)
diff --git a/examples/demos/dice/CMakeLists.txt b/examples/demos/dice/CMakeLists.txt
index 1dbb993a3..7d3cf2b16 100644
--- a/examples/demos/dice/CMakeLists.txt
+++ b/examples/demos/dice/CMakeLists.txt
@@ -5,12 +5,6 @@ cmake_minimum_required(VERSION 3.14)
set(appname "qtdice")
project(${appname} LANGUAGES CXX)
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}")
-
find_package(Qt6 REQUIRED COMPONENTS Core Gui Quick Quick3D Quick3DPhysics Multimedia Sensors)
qt_standard_project_setup()
@@ -86,7 +80,16 @@ qt_add_resources(${appname} "qml"
)
install(TARGETS ${appname}
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION .
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+)
+
+qt_generate_deploy_qml_app_script(
+ TARGET ${appname}
+ OUTPUT_SCRIPT deploy_script
+ MACOS_BUNDLE_POST_BUILD
+ NO_UNSUPPORTED_PLATFORM_ERROR
+ DEPLOY_USER_QML_MODULES_ON_UNSUPPORTED_PLATFORM
)
+install(SCRIPT ${deploy_script})
diff --git a/examples/demos/documentviewer/CMakeLists.txt b/examples/demos/documentviewer/CMakeLists.txt
index 372f735d5..097f3d12b 100644
--- a/examples/demos/documentviewer/CMakeLists.txt
+++ b/examples/demos/documentviewer/CMakeLists.txt
@@ -4,12 +4,6 @@
cmake_minimum_required(VERSION 3.16)
project(documentviewer LANGUAGES CXX)
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/demos/documentviewer")
-
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets
OPTIONAL_COMPONENTS PrintSupport Pdf PdfWidgets Quick3D)
diff --git a/examples/demos/documentviewer/app/CMakeLists.txt b/examples/demos/documentviewer/app/CMakeLists.txt
index 6331f54e8..92eaf80cd 100644
--- a/examples/demos/documentviewer/app/CMakeLists.txt
+++ b/examples/demos/documentviewer/app/CMakeLists.txt
@@ -66,9 +66,13 @@ if(TARGET Qt6::PrintSupport)
add_compile_definitions(QT_DOCUMENTVIEWER_PRINTSUPPORT)
endif()
-install(TARGETS documentviewer abstractviewer
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+install(TARGETS documentviewer
+ BUNDLE DESTINATION .
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
+install(TARGETS abstractviewer
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+)
diff --git a/examples/demos/documentviewer/plugins/jsonviewer/CMakeLists.txt b/examples/demos/documentviewer/plugins/jsonviewer/CMakeLists.txt
index 2aea01c40..8cb87ec4a 100644
--- a/examples/demos/documentviewer/plugins/jsonviewer/CMakeLists.txt
+++ b/examples/demos/documentviewer/plugins/jsonviewer/CMakeLists.txt
@@ -28,8 +28,14 @@ if(TARGET Qt6::PrintSupport)
target_link_libraries(jsonviewer PRIVATE Qt6::PrintSupport)
endif()
+if(WIN32)
+ set(install_destination "${CMAKE_INSTALL_BINDIR}/app")
+elseif(APPLE)
+ set(install_destination ".")
+else()
+ set(install_destination "${CMAKE_INSTALL_BINDIR}")
+endif()
install(TARGETS jsonviewer
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+ RUNTIME DESTINATION "${install_destination}"
+ LIBRARY DESTINATION "${install_destination}"
)
-
diff --git a/examples/demos/documentviewer/plugins/pdfviewer/CMakeLists.txt b/examples/demos/documentviewer/plugins/pdfviewer/CMakeLists.txt
index f3b8dbf9a..101b84ce5 100644
--- a/examples/demos/documentviewer/plugins/pdfviewer/CMakeLists.txt
+++ b/examples/demos/documentviewer/plugins/pdfviewer/CMakeLists.txt
@@ -32,8 +32,14 @@ if(TARGET Qt6::PrintSupport)
target_link_libraries(pdfviewer PRIVATE Qt6::PrintSupport)
endif()
+if(WIN32)
+ set(install_destination "${CMAKE_INSTALL_BINDIR}/app")
+elseif(APPLE)
+ set(install_destination ".")
+else()
+ set(install_destination "${CMAKE_INSTALL_BINDIR}")
+endif()
install(TARGETS pdfviewer
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+ RUNTIME DESTINATION "${install_destination}"
+ LIBRARY DESTINATION "${install_destination}"
)
-
diff --git a/examples/demos/documentviewer/plugins/q3dviewer/CMakeLists.txt b/examples/demos/documentviewer/plugins/q3dviewer/CMakeLists.txt
index e913fdd82..1b8137e85 100644
--- a/examples/demos/documentviewer/plugins/q3dviewer/CMakeLists.txt
+++ b/examples/demos/documentviewer/plugins/q3dviewer/CMakeLists.txt
@@ -37,8 +37,14 @@ qt_add_resources(Q3Dviewer "qml"
queryMimeTypes.qml
)
+if(WIN32)
+ set(install_destination "${CMAKE_INSTALL_BINDIR}/app")
+elseif(APPLE)
+ set(install_destination ".")
+else()
+ set(install_destination "${CMAKE_INSTALL_BINDIR}")
+endif()
install(TARGETS Q3Dviewer
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+ RUNTIME DESTINATION "${install_destination}"
+ LIBRARY DESTINATION "${install_destination}"
)
-
diff --git a/examples/demos/documentviewer/plugins/txtviewer/CMakeLists.txt b/examples/demos/documentviewer/plugins/txtviewer/CMakeLists.txt
index db85766b7..42d6dd6bb 100644
--- a/examples/demos/documentviewer/plugins/txtviewer/CMakeLists.txt
+++ b/examples/demos/documentviewer/plugins/txtviewer/CMakeLists.txt
@@ -28,8 +28,14 @@ if(TARGET Qt6::PrintSupport)
target_link_libraries(txtviewer PRIVATE Qt6::PrintSupport)
endif()
+if(WIN32)
+ set(install_destination "${CMAKE_INSTALL_BINDIR}/app")
+elseif(APPLE)
+ set(install_destination ".")
+else()
+ set(install_destination "${CMAKE_INSTALL_BINDIR}")
+endif()
install(TARGETS txtviewer
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+ RUNTIME DESTINATION "${install_destination}"
+ LIBRARY DESTINATION "${install_destination}"
)
-
diff --git a/examples/demos/hangman/CMakeLists.txt b/examples/demos/hangman/CMakeLists.txt
index 3ef7e70c9..e6a8ae348 100644
--- a/examples/demos/hangman/CMakeLists.txt
+++ b/examples/demos/hangman/CMakeLists.txt
@@ -10,11 +10,6 @@ project(hangman LANGUAGES CXX)
set(CMAKE_AUTOMOC ON)
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/demos/hangman")
set(OUTPUT_DIRECTORY "${INSTALL_EXAMPLESDIR}/demos/hangman")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick QuickControls2)
@@ -103,7 +98,16 @@ target_link_libraries(hangman PRIVATE
qt_finalize_executable(hangman)
install(TARGETS hangman
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION .
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+)
+
+qt_generate_deploy_qml_app_script(
+ TARGET hangman
+ OUTPUT_SCRIPT deploy_script
+ MACOS_BUNDLE_POST_BUILD
+ NO_UNSUPPORTED_PLATFORM_ERROR
+ DEPLOY_USER_QML_MODULES_ON_UNSUPPORTED_PLATFORM
)
+install(SCRIPT ${deploy_script})
diff --git a/examples/demos/lightningviewer/CMakeLists.txt b/examples/demos/lightningviewer/CMakeLists.txt
index 090fba45e..eddbe93c3 100644
--- a/examples/demos/lightningviewer/CMakeLists.txt
+++ b/examples/demos/lightningviewer/CMakeLists.txt
@@ -4,12 +4,6 @@
cmake_minimum_required(VERSION 3.16)
project(LightningViewerExample VERSION 1.0 LANGUAGES CXX)
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/demos/${PROJECT_NAME}")
-
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(Qt6 REQUIRED COMPONENTS Quick QuickControls2)
@@ -42,10 +36,19 @@ set_target_properties(${PROJECT_NAME} PROPERTIES
)
install(TARGETS ${PROJECT_NAME}
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION .
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+)
+
+qt_generate_deploy_qml_app_script(
+ TARGET ${PROJECT_NAME}
+ OUTPUT_SCRIPT deploy_script
+ MACOS_BUNDLE_POST_BUILD
+ NO_UNSUPPORTED_PLATFORM_ERROR
+ DEPLOY_USER_QML_MODULES_ON_UNSUPPORTED_PLATFORM
)
+install(SCRIPT ${deploy_script})
if (ANDROID)
include(FetchContent)
diff --git a/examples/demos/lightningviewer/LightningViewer/CMakeLists.txt b/examples/demos/lightningviewer/LightningViewer/CMakeLists.txt
index a3af46a95..b5a38aa3f 100644
--- a/examples/demos/lightningviewer/LightningViewer/CMakeLists.txt
+++ b/examples/demos/lightningviewer/LightningViewer/CMakeLists.txt
@@ -50,3 +50,11 @@ target_link_libraries(${PROJECT_NAME} PRIVATE
Qt6::Quick
Qt6::WebSockets
)
+
+install(TARGETS ${PROJECT_NAME}
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}/LightningViewer"
+ LIBRARY DESTINATION "${CMAKE_INSTALL_BINDIR}/LightningViewer"
+)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/qmldir
+ DESTINATION "${CMAKE_INSTALL_BINDIR}/LightningViewer"
+)
diff --git a/examples/demos/lightningviewer/LightningViewerStyle/CMakeLists.txt b/examples/demos/lightningviewer/LightningViewerStyle/CMakeLists.txt
index 76ba14628..92971c008 100644
--- a/examples/demos/lightningviewer/LightningViewerStyle/CMakeLists.txt
+++ b/examples/demos/lightningviewer/LightningViewerStyle/CMakeLists.txt
@@ -122,3 +122,11 @@ qt_add_qml_module(${PROJECT_NAME}
target_link_libraries(${PROJECT_NAME} PRIVATE
Qt6::Quick
)
+
+install(TARGETS ${PROJECT_NAME}
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}/LightningViewerStyle"
+ LIBRARY DESTINATION "${CMAKE_INSTALL_BINDIR}/LightningViewerStyle"
+)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/qmldir
+ DESTINATION "${CMAKE_INSTALL_BINDIR}/LightningViewerStyle"
+)
diff --git a/examples/demos/maroon/CMakeLists.txt b/examples/demos/maroon/CMakeLists.txt
index 9d52cdf51..3b762ac81 100644
--- a/examples/demos/maroon/CMakeLists.txt
+++ b/examples/demos/maroon/CMakeLists.txt
@@ -6,12 +6,6 @@ project(maroon LANGUAGES CXX)
set(CMAKE_AUTOMOC ON)
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/demos/maroon")
-
find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick)
qt_add_executable(maroon
@@ -115,7 +109,16 @@ if(TARGET Qt6::Multimedia)
endif()
install(TARGETS maroon
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION .
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+)
+
+qt_generate_deploy_qml_app_script(
+ TARGET maroon
+ OUTPUT_SCRIPT deploy_script
+ MACOS_BUNDLE_POST_BUILD
+ NO_UNSUPPORTED_PLATFORM_ERROR
+ DEPLOY_USER_QML_MODULES_ON_UNSUPPORTED_PLATFORM
)
+install(SCRIPT ${deploy_script})
diff --git a/examples/demos/mediaplayer/CMakeLists.txt b/examples/demos/mediaplayer/CMakeLists.txt
index 69601590f..337d6fc34 100644
--- a/examples/demos/mediaplayer/CMakeLists.txt
+++ b/examples/demos/mediaplayer/CMakeLists.txt
@@ -4,12 +4,6 @@ project(MediaPlayerApp LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/demos/mediaplayer")
-
find_package(Qt6 6.5 REQUIRED COMPONENTS Core Quick QuickControls2 Svg Multimedia)
qt_standard_project_setup(REQUIRES 6.5)
@@ -34,7 +28,16 @@ target_link_libraries(MediaPlayerApp PRIVATE
)
install(TARGETS MediaPlayerApp
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION .
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+)
+
+qt_generate_deploy_qml_app_script(
+ TARGET MediaPlayerApp
+ OUTPUT_SCRIPT deploy_script
+ MACOS_BUNDLE_POST_BUILD
+ NO_UNSUPPORTED_PLATFORM_ERROR
+ DEPLOY_USER_QML_MODULES_ON_UNSUPPORTED_PLATFORM
)
+install(SCRIPT ${deploy_script})
diff --git a/examples/demos/osmbuildings/CMakeLists.txt b/examples/demos/osmbuildings/CMakeLists.txt
index 9cf7bba77..6da9cb57b 100644
--- a/examples/demos/osmbuildings/CMakeLists.txt
+++ b/examples/demos/osmbuildings/CMakeLists.txt
@@ -6,12 +6,6 @@ project(osmbuildings LANGUAGES CXX)
set(CMAKE_AUTOMOC ON)
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/demos/osmbuildings")
-
find_package(Qt6 REQUIRED COMPONENTS Core Gui Quick Quick3D Positioning)
qt_add_executable(osmbuildings
@@ -56,7 +50,16 @@ qt_add_qml_module(osmbuildings
)
install(TARGETS osmbuildings
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION .
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+)
+
+qt_generate_deploy_qml_app_script(
+ TARGET osmbuildings
+ OUTPUT_SCRIPT deploy_script
+ MACOS_BUNDLE_POST_BUILD
+ NO_UNSUPPORTED_PLATFORM_ERROR
+ DEPLOY_USER_QML_MODULES_ON_UNSUPPORTED_PLATFORM
)
+install(SCRIPT ${deploy_script})
diff --git a/examples/demos/photosurface/CMakeLists.txt b/examples/demos/photosurface/CMakeLists.txt
index 28695ee64..f727ac206 100644
--- a/examples/demos/photosurface/CMakeLists.txt
+++ b/examples/demos/photosurface/CMakeLists.txt
@@ -6,12 +6,6 @@ project(photosurface LANGUAGES CXX)
set(CMAKE_AUTOMOC ON)
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/demos/photosurface")
-
find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick ShaderTools)
qt_standard_project_setup()
@@ -71,7 +65,16 @@ qt_add_shaders(photosurfaceexample "shaders"
)
install(TARGETS photosurfaceexample
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION .
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+)
+
+qt_generate_deploy_qml_app_script(
+ TARGET photosurfaceexample
+ OUTPUT_SCRIPT deploy_script
+ MACOS_BUNDLE_POST_BUILD
+ NO_UNSUPPORTED_PLATFORM_ERROR
+ DEPLOY_USER_QML_MODULES_ON_UNSUPPORTED_PLATFORM
)
+install(SCRIPT ${deploy_script})
diff --git a/examples/demos/robotarm/CMakeLists.txt b/examples/demos/robotarm/CMakeLists.txt
index a78912c77..e642971f4 100644
--- a/examples/demos/robotarm/CMakeLists.txt
+++ b/examples/demos/robotarm/CMakeLists.txt
@@ -5,12 +5,6 @@ project(RobotArm LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/demos/robotarm")
-
find_package(Qt6 REQUIRED COMPONENTS Gui Qml Quick Quick3D)
qt_standard_project_setup()
qt_add_executable(RobotArmApp src/main.cpp)
@@ -32,7 +26,16 @@ add_subdirectory(Backend)
include(${CMAKE_CURRENT_SOURCE_DIR}/qmlmodules)
install(TARGETS RobotArmApp
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION .
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+)
+
+qt_generate_deploy_qml_app_script(
+ TARGET RobotArmApp
+ OUTPUT_SCRIPT deploy_script
+ MACOS_BUNDLE_POST_BUILD
+ NO_UNSUPPORTED_PLATFORM_ERROR
+ DEPLOY_USER_QML_MODULES_ON_UNSUPPORTED_PLATFORM
)
+install(SCRIPT ${deploy_script})
diff --git a/examples/demos/rssnews/CMakeLists.txt b/examples/demos/rssnews/CMakeLists.txt
index 481b1405b..3cee58e9e 100644
--- a/examples/demos/rssnews/CMakeLists.txt
+++ b/examples/demos/rssnews/CMakeLists.txt
@@ -6,12 +6,6 @@ project(rssnews LANGUAGES CXX)
set(CMAKE_AUTOMOC ON)
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/demos/rssnews")
-
find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml QmlXmlListModel Quick)
qt_add_executable(rssnews
@@ -64,7 +58,16 @@ qt_add_resources(rssnews "rssnews"
)
install(TARGETS rssnews
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION .
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+)
+
+qt_generate_deploy_qml_app_script(
+ TARGET rssnews
+ OUTPUT_SCRIPT deploy_script
+ MACOS_BUNDLE_POST_BUILD
+ NO_UNSUPPORTED_PLATFORM_ERROR
+ DEPLOY_USER_QML_MODULES_ON_UNSUPPORTED_PLATFORM
)
+install(SCRIPT ${deploy_script})
diff --git a/examples/demos/samegame/CMakeLists.txt b/examples/demos/samegame/CMakeLists.txt
index 7c1997a7c..8fb06afa3 100644
--- a/examples/demos/samegame/CMakeLists.txt
+++ b/examples/demos/samegame/CMakeLists.txt
@@ -6,12 +6,6 @@ project(samegame LANGUAGES CXX)
set(CMAKE_AUTOMOC ON)
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/demos/samegame")
-
find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick Sql)
qt_add_executable(samegame
@@ -112,7 +106,16 @@ qt_add_resources(samegame "samegame"
)
install(TARGETS samegame
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION .
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+)
+
+qt_generate_deploy_qml_app_script(
+ TARGET samegame
+ OUTPUT_SCRIPT deploy_script
+ MACOS_BUNDLE_POST_BUILD
+ NO_UNSUPPORTED_PLATFORM_ERROR
+ DEPLOY_USER_QML_MODULES_ON_UNSUPPORTED_PLATFORM
)
+install(SCRIPT ${deploy_script})
diff --git a/examples/demos/stocqt/CMakeLists.txt b/examples/demos/stocqt/CMakeLists.txt
index 354927dd8..cd2915c22 100644
--- a/examples/demos/stocqt/CMakeLists.txt
+++ b/examples/demos/stocqt/CMakeLists.txt
@@ -8,12 +8,6 @@ project(StocQt VERSION 0.1 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_AUTOMOC ON)
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/demos/stocqt")
-
find_package(Qt6 ${PROJECT_VERSION} REQUIRED COMPONENTS Core Gui Qml Quick Graphs)
qt_standard_project_setup(REQUIRES 6.5)
@@ -83,13 +77,6 @@ target_link_libraries(appStocQt PRIVATE
Qt6::Graphs
)
-include(GNUInstallDirs)
-install(TARGETS appStocQt
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
-
set (data_resource_files
"data/AAPL.json"
"data/ABNB.json"
@@ -201,3 +188,18 @@ qt6_add_resources(appStocQt "data"
FILES
${data_resource_files}
)
+
+install(TARGETS appStocQt
+ BUNDLE DESTINATION .
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+)
+
+qt_generate_deploy_qml_app_script(
+ TARGET appStocQt
+ OUTPUT_SCRIPT deploy_script
+ MACOS_BUNDLE_POST_BUILD
+ NO_UNSUPPORTED_PLATFORM_ERROR
+ DEPLOY_USER_QML_MODULES_ON_UNSUPPORTED_PLATFORM
+)
+install(SCRIPT ${deploy_script})
diff --git a/examples/demos/thermostat/CMakeLists.txt b/examples/demos/thermostat/CMakeLists.txt
index df38ce465..7aada026d 100644
--- a/examples/demos/thermostat/CMakeLists.txt
+++ b/examples/demos/thermostat/CMakeLists.txt
@@ -3,8 +3,6 @@
cmake_minimum_required(VERSION 3.16)
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/demos/thermostat")
-
project(ThermostatApp LANGUAGES CXX)
find_package(Qt6 6.5 REQUIRED COMPONENTS Gui Qml Quick QuickControls2 Svg Charts)
@@ -32,7 +30,16 @@ target_link_libraries(ThermostatApp PRIVATE
)
install(TARGETS ThermostatApp
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION .
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+)
+
+qt_generate_deploy_qml_app_script(
+ TARGET ThermostatApp
+ OUTPUT_SCRIPT deploy_script
+ MACOS_BUNDLE_POST_BUILD
+ NO_UNSUPPORTED_PLATFORM_ERROR
+ DEPLOY_USER_QML_MODULES_ON_UNSUPPORTED_PLATFORM
)
+install(SCRIPT ${deploy_script})
diff --git a/examples/demos/todolist/CMakeLists.txt b/examples/demos/todolist/CMakeLists.txt
index 31b7be16f..ead0e175e 100644
--- a/examples/demos/todolist/CMakeLists.txt
+++ b/examples/demos/todolist/CMakeLists.txt
@@ -3,8 +3,6 @@
cmake_minimum_required(VERSION 3.18)
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/demos/todolist")
-
project(ToDoListApp LANGUAGES CXX)
find_package(Qt6 6.5 COMPONENTS Gui Qml Quick QuickControls2)
@@ -30,7 +28,16 @@ target_link_libraries(ToDoListApp PRIVATE
)
install(TARGETS ToDoListApp
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION .
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+)
+
+qt_generate_deploy_qml_app_script(
+ TARGET ToDoListApp
+ OUTPUT_SCRIPT deploy_script
+ MACOS_BUNDLE_POST_BUILD
+ NO_UNSUPPORTED_PLATFORM_ERROR
+ DEPLOY_USER_QML_MODULES_ON_UNSUPPORTED_PLATFORM
)
+install(SCRIPT ${deploy_script})
diff --git a/examples/tutorials/alarms/CMakeLists.txt b/examples/tutorials/alarms/CMakeLists.txt
index dc80af5f7..6fb68158a 100644
--- a/examples/tutorials/alarms/CMakeLists.txt
+++ b/examples/tutorials/alarms/CMakeLists.txt
@@ -6,12 +6,6 @@ project(alarms LANGUAGES CXX)
set(CMAKE_AUTOMOC ON)
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/demos/alarms")
-
find_package(Qt6 REQUIRED COMPONENTS Core Gui Quick)
qt_add_executable(alarms
@@ -53,7 +47,16 @@ qt_add_resources(alarms "controls_conf"
)
install(TARGETS alarms
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION .
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+)
+
+qt_generate_deploy_qml_app_script(
+ TARGET alarms
+ OUTPUT_SCRIPT deploy_script
+ MACOS_BUNDLE_POST_BUILD
+ NO_UNSUPPORTED_PLATFORM_ERROR
+ DEPLOY_USER_QML_MODULES_ON_UNSUPPORTED_PLATFORM
)
+install(SCRIPT ${deploy_script})