summaryrefslogtreecommitdiffstats
path: root/examples/tutorials
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 /examples/tutorials
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>
Diffstat (limited to 'examples/tutorials')
-rw-r--r--examples/tutorials/alarms/CMakeLists.txt21
1 files changed, 12 insertions, 9 deletions
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})