summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2022-05-03 18:17:37 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2022-05-20 13:05:53 +0200
commit8370427c43ee1a9e52cadd24fd67a7a18ef08230 (patch)
treec432ba36682d7585daba5f3def03cc8c5119dba4
parente2620b538b6b7383b1f9814ed54ebaac46de3b60 (diff)
CMake: Set default xcode device family to iPhone and iPad
This matches what we do with qmake, which means a build application can be deployed to either an iPhone or an iPad by default, without having to fiddle with Xcode settings. The device family will not be set if the target XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY property or the CMAKE_XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY variable has a value. There's also an opt-out variable called QT_NO_SET_XCODE_TARGETED_DEVICE_FAMILY Pick-to: 6.2 6.3 Fixes: QTBUG-100833 Change-Id: I8cde10975b44af81cfa18f985523c8ec1529386d Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
-rw-r--r--src/corelib/Qt6CoreMacros.cmake16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/corelib/Qt6CoreMacros.cmake b/src/corelib/Qt6CoreMacros.cmake
index 3e040ff2bd..0e11592e28 100644
--- a/src/corelib/Qt6CoreMacros.cmake
+++ b/src/corelib/Qt6CoreMacros.cmake
@@ -943,10 +943,26 @@ function(_qt_internal_set_xcode_product_bundle_identifier target)
endif()
endfunction()
+function(_qt_internal_set_xcode_targeted_device_family target)
+ if(NOT CMAKE_XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY
+ AND NOT QT_NO_SET_XCODE_TARGETED_DEVICE_FAMILY)
+ get_target_property(existing_device_family
+ "${target}" XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY)
+ if(NOT existing_device_family)
+ set(device_family_iphone_and_ipad "1,2")
+ set_target_properties("${target}"
+ PROPERTIES
+ XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY
+ "${device_family_iphone_and_ipad}")
+ endif()
+ endif()
+endfunction()
+
function(_qt_internal_finalize_ios_app target)
_qt_internal_set_xcode_development_team_id("${target}")
_qt_internal_set_xcode_bundle_identifier("${target}")
_qt_internal_set_xcode_product_bundle_identifier("${target}")
+ _qt_internal_set_xcode_targeted_device_family("${target}")
_qt_internal_handle_ios_launch_screen("${target}")
_qt_internal_set_placeholder_apple_bundle_version("${target}")