diff options
author | Olivier De Cannière <olivier.decanniere@qt.io> | 2023-07-04 14:51:34 +0200 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2023-07-07 16:32:31 +0800 |
commit | fb64096a25f8e847b26c17a5888321e2fbbc4fbb (patch) | |
tree | 0bf41c371b6970a5671115b9321f1cffd08d8a06 /examples/quickcontrols/wearable/CMakeLists.txt | |
parent | 4f9cae381f56f9c0efe4f6b7646c2e7853613801 (diff) |
Fix wearable example on macOS and Windows
- Use add_qml_module_to_macos_app_bundle and copy other things from examples
like attachedstyleproperties and painteditem in order to get it to work on
macOS.
- Move qt_standard_project_setup() before qt_add_qml_module() (which is
called by the three add_subdirectory calls). This is required to avoid
issues with subdirectories on Windows.
Pick-to: 6.5 6.6
Change-Id: Ie0d859c743d0b8b798238346cc2c738ece362c99
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'examples/quickcontrols/wearable/CMakeLists.txt')
-rw-r--r-- | examples/quickcontrols/wearable/CMakeLists.txt | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/examples/quickcontrols/wearable/CMakeLists.txt b/examples/quickcontrols/wearable/CMakeLists.txt index 7b337ee61d..833b1b409f 100644 --- a/examples/quickcontrols/wearable/CMakeLists.txt +++ b/examples/quickcontrols/wearable/CMakeLists.txt @@ -2,7 +2,7 @@ # SPDX-License-Identifier: BSD-3-Clause cmake_minimum_required(VERSION 3.16) -project(wearableexample LANGUAGES CXX) +project(wearableexample VERSION 1 LANGUAGES CXX) set(CMAKE_AUTOMOC ON) @@ -12,14 +12,14 @@ endif() set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quickcontrols/wearable") -add_subdirectory(Wearable) -add_subdirectory(WearableSettings) -add_subdirectory(WearableStyle) - find_package(Qt6 REQUIRED COMPONENTS Core Gui Quick QuickControls2) qt_standard_project_setup() +add_subdirectory(Wearable) +add_subdirectory(WearableSettings) +add_subdirectory(WearableStyle) + qt_add_executable(wearableexample WIN32 MACOSX_BUNDLE wearable.cpp ) @@ -38,8 +38,22 @@ if(UNIX AND NOT APPLE AND CMAKE_CROSSCOMPILING) target_link_libraries(wearableexample PRIVATE Qt6::QuickTemplates2) endif() +set_target_properties(wearableexample PROPERTIES + MACOSX_BUNDLE TRUE + MACOSX_BUNDLE_GUI_IDENTIFIER "io.qt.examples.wearable" + MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION} + MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} +) + install(TARGETS wearableexample RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" ) + +include(../../quick/shared/QtBundleQmlModuleForMacOS.cmake) + +set(app_target "wearableexample") +add_qml_module_to_macos_app_bundle("${app_target}" "wearableplugin" "Wearable") +add_qml_module_to_macos_app_bundle("${app_target}" "wearablesettingsplugin" "WearableSettings") +add_qml_module_to_macos_app_bundle("${app_target}" "wearablestyleplugin" "WearableStyle") |