Customizes aspects of a target's finalization.
注意: This command is in technology preview and may change in future releases.
qt_set_finalizer_mode(target ENABLE | DISABLE MODES modes... )
若
无版本命令
被禁用,使用
qt6_set_finalizer_mode()
代替。它支持如此命令的一组相同自变量。
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:
模式 | 默认 | 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)
另请参阅 qt_finalize_target ().