Customizes aspects of a target's finalization.
This command was introduced in Qt 6.2.
Note: This command is in technology preview and may change in future releases.
qt_set_finalizer_mode(target ENABLE | DISABLE MODES modes... )
If versionless commands are disabled, use qt6_set_finalizer_mode()
instead. It supports the same set of arguments as this command.
This command is used to customize some aspects of the finalization of a specific target
. It only has an effect if called before target
is finalized, which occurs in one of the following
scenarios:
target
. This usually means the MANUAL_FINALIZATION
keyword was passed to
qt_add_executable() when the target
was defined.
MANUAL_FINALIZATION
keyword was not passed to qt_add_executable() when the target
was defined,
and deferred finalization has been completed at the end of the target
's directory scope.
qt_set_finalizer_mode()
is used to enable or disable a list of modes, where a mode corresponds to a specific aspect of finalization. The currently supported finalization modes are:
Mode | Default | Finalization behavior |
---|---|---|
static_plugins |
Enabled | When Qt is built statically, it creates initializer object libraries for its static plugins. If target is an executable and this finalization mode is enabled, any plugin initializer object libraries
needed by the target will be directly linked to it. This prevents cycles between Qt-provided static libraries and may reduce link time. When this finalizer mode is disabled, each plugin initializer is instead
propagated via usage requirements of its associated Qt library, which may cause cycles. If Qt is not built statically, this finalizer mode is not relevant and isn't used. |
The following example assumes you are using CMake 3.19 or later (required for deferred finalization):
qt_add_executable(my_app main.cpp) qt_set_finalizer_mode(my_app ENABLE MODES static_plugins)
The same example using manual finalization might look like this:
qt_add_executable(my_app MANUAL_FINALIZATION main.cpp) qt_set_finalizer_mode(my_app ENABLE MODES static_plugins) qt_finalize_target(my_app)
See also qt_finalize_target().
As part of the free Business evaluation, we offer a free welcome call for companies, to talk about your requirements, and how the Felgo SDK & Services can help you. Just sign up and schedule your call.
Sign up now to start your free Business evaluation: