diff options
author | Juha Vuolle <juha.vuolle@insta.fi> | 2021-11-08 14:01:23 +0200 |
---|---|---|
committer | Juha Vuolle <juha.vuolle@insta.fi> | 2021-11-11 08:19:15 +0200 |
commit | 70d590a81cae3c122c68bcb4521f21771cf02d40 (patch) | |
tree | a143358d2500b4c366c6a12ec77b4711844b3cc0 /examples/bluetooth/lowenergyscanner/CMakeLists.txt | |
parent | c36d6b389908c6a2b68d6cdc94c129567eefe2e9 (diff) |
macOS specific Info.plist file for Bluetooth Examples
The default generated Info.plist is not enough as the Bluetooth examples
require NSBluetoothAlwaysUsageDescription key to work. Without this
patch on macOS 12 there are two possible outcomes:
1) If the example is built with qmake, the application will crash
and the crash report will indicate that the key is missing
2) If the example is built with CMake, the application will not start
as it tries to use iOS specific .plist file
The patch uses absolute paths in the example CMakeLists.txt files
to work around a Ninja bug:
https://gitlab.kitware.com/cmake/cmake/-/issues/20181
Using relative paths resulted in "multiple rules generate" errors
if the QtConnectivity module is built with examples.
Note that the plist files are only effective if the application is
started as an app bundle, ie. not if launching the contained binary
directly.
Pick-to: 6.2
Task-number: QTBUG-98090
Change-Id: Iedb7eabbb8fde6ad1ba14ada1a7ee87ec1d708ba
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'examples/bluetooth/lowenergyscanner/CMakeLists.txt')
-rw-r--r-- | examples/bluetooth/lowenergyscanner/CMakeLists.txt | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/examples/bluetooth/lowenergyscanner/CMakeLists.txt b/examples/bluetooth/lowenergyscanner/CMakeLists.txt index d1a9e658..64a41e8d 100644 --- a/examples/bluetooth/lowenergyscanner/CMakeLists.txt +++ b/examples/bluetooth/lowenergyscanner/CMakeLists.txt @@ -40,10 +40,18 @@ target_link_libraries(lowenergyscanner PUBLIC Qt::Quick ) -if(APPLE) - set_target_properties(lowenergyscanner PROPERTIES - MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Info.plist" - ) +if (APPLE) + if (IOS) + set_target_properties(lowenergyscanner PROPERTIES + MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Info.plist" + ) + else() + # Using absolute path for shared plist files is a Ninja bug workaround + get_filename_component(SHARED_PLIST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../shared ABSOLUTE) + set_target_properties(lowenergyscanner PROPERTIES + MACOSX_BUNDLE_INFO_PLIST "${SHARED_PLIST_DIR}/Info.cmake.macos.plist" + ) + endif() endif() |