Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qt_finalize_target.qdoc
Go to the documentation of this file.
1// Copyright (C) 2020 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4/*!
5\page qt-finalize-target.html
6\ingroup cmake-commands-qtcore
7
8\title qt_finalize_target
9\keyword qt_finalize_target()
10
11\summary {Handles various common platform-specific tasks associated with Qt targets.}
12
13\include cmake-find-package-core.qdocinc
14
15\cmakecommandsince 6.2
16
17\section1 Synopsis
18
19\badcode
20qt_finalize_target(target)
21\endcode
22
23\versionlessCMakeCommandsNote qt6_finalize_target()
24
25\section1 Description
26
27After a target is created, further processing or \e{finalization} steps are
28sometimes needed. The steps to perform depend on the platform, the type of
29target, and on various properties of the target. These steps are expected to be
30performed within the same directory scope as the one in which the \c{target}
31was created, so this command should also be called from that same directory
32scope.
33
34This command is ordinarily invoked as part of a call to
35\l qt_add_executable(),
36\l qt_add_library(), or \l qt_add_plugin().
37The timing of when that call takes place and when a project might need to call
38it explicitly, is discussed in the documentation of those commands.
39
40\sa qt_set_finalizer_mode()
41
42\section1 Executable Targets
43
44For executable targets, \c{qt_finalize_target()} implements the logic described
45in the subsections below, as appropriate for the platform and target provided.
46Later Qt releases may expand finalization processing further.
47
48\section2 All Platforms
49
50Some internal processing is performed to facilitate automatic linking of Qt
51plugins. This is especially important if using a statically built Qt or a
52CMake version earlier than 3.21.
53
54\section2 Android
55
56\list
57\li Generate a deployment settings file for the \c target.
58\li Create a build target for generating an APK.
59\endlist
60
61\section2 WASM
62
63Create \c{${target}.html} (a target-specific \c{wasm_shell.html} file),
64\c{qtloader.js}, and \c{qtlogo.svg} files in the \c{CMAKE_CURRENT_BINARY_DIR}.
65
66\section2 iOS
67
68Finalization attempts to provide sensible values for the following target
69properties if they are not already set, and their corresponding \c{CMAKE_...}
70variable is also not set:
71
72\list
73\li \c XCODE_ATTRIBUTE_DEVELOPMENT_TEAM
74\li \c XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER
75\li \c MACOSX_BUNDLE_GUI_IDENTIFIER
76\endlist
77
78If required, the \l QT_NO_SET_XCODE_DEVELOPMENT_TEAM_ID variable can be used to
79disable setting \c XCODE_ATTRIBUTE_DEVELOPMENT_TEAM, and the
80\l QT_NO_SET_XCODE_BUNDLE_IDENTIFIER variable can be used to disable setting
81\c XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER and \c MACOSX_BUNDLE_GUI_IDENTIFIER.
82
83\section3 Embedding Shared Library Dependencies
84\target apple-embed-shared-library-dependencies
85
86An application that depends on shared libraries can only launch if the
87shared libraries it links against are part of its bundle.
88
89Since Qt 6.12, the build system collects the shared libraries the
90application links against, and adds them to the application's
91\c XCODE_EMBED_FRAMEWORKS build phase, with \c CODE_SIGN_ON_COPY enabled.
92Both framework bundles and plain \c dylib libraries are handled.
93
94Embedding is only done if all of the following apply:
95
96\list
97\li Qt was built in a shared library configuration.
98\li The Xcode generator is used.
99\li Qt was not built with both a debug and a release configuration, because
100 \c XCODE_EMBED_FRAMEWORKS holds a single path per library and can therefore
101 not describe both configurations.
102\li The target is an application bundle, and not a child bundle like an app
103 extension. Child bundles are expected to use the frameworks of their
104 parent application.
105\li The \c XCODE_EMBED_FRAMEWORKS property is not already set on the target,
106 which is taken as a sign that the project handles embedding itself.
107\endlist
108
109To deploy the shared libraries yourself, set the
110\l{cmake-target-property-QT_NO_XCODE_EMBED_FRAMEWORKS}
111{QT_NO_XCODE_EMBED_FRAMEWORKS} property on the application target.
112
113To leave out individual libraries, set the
114\l{cmake-target-property-QT_NO_XCODE_EMBED_FRAMEWORK_IN_CONSUMERS}
115{QT_NO_XCODE_EMBED_FRAMEWORK_IN_CONSUMERS} property on those libraries.
116
117\section1 Library Targets
118
119As of this Qt version, finalization for library targets does not perform any
120processing. Future Qt versions may add finalization processing for libraries,
121so you should ensure finalization is still invoked in the expected way.
122
123*/