cmake: Allow static library framework builds for macOS and iOS

Frameworks on Apple systems have traditionally been wrappers around
dynamic libraries (with headers and other resources bundled alongside
the library), but nowadays it's fully supported to have frameworks
with static libraries inside them.

Enabling this allows us to build Qt for iOS statically, but as
frameworks, which allows us to include privacy manifests for the
Qt libraries in the frameworks.

At build time Xcode will link the static library into the application,
as normal, so nothing changes there. If the user then chooses to
embed the Qt frameworks via the Xcode UI, the build system will
not copy the static libraries inside the frameworks, but will
copy the privacy manifest and other resources, which in turn
allows Xcode to generate a privacy report for the application
as a whole.

Task-number: QTBUG-114319
Change-Id: Ibc8c70a97d288e27811eaedd242613fa206617e5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Tor Arne Vestbø 2024-02-12 18:26:16 +01:00
parent 5c05f5cd7f
commit 291817b0bf

View File

@ -563,7 +563,8 @@ qt_feature("headersclean"
qt_feature_config("headersclean" QMAKE_PRIVATE_CONFIG)
qt_feature("framework" PUBLIC
LABEL "Build Apple Frameworks"
CONDITION APPLE AND BUILD_SHARED_LIBS
AUTODETECT BUILD_SHARED_LIBS
CONDITION APPLE
)
qt_feature_definition("framework" "QT_MAC_FRAMEWORK_BUILD")
qt_feature_config("framework" QMAKE_PUBLIC_QT_CONFIG