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:
- The project explicitly calls qt_finalize_target() for the
target. This usually means the
MANUAL_FINALIZATIONkeyword was passed to qt_add_executable() when the
- CMake 3.17 or earlier is being used, in which case finalization always occurs immediately as part of the call to qt_add_executable().
- CMake 3.18 or later is being used, the
MANUAL_FINALIZATIONkeyword was not passed to qt_add_executable() when the
targetwas 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:
|Enabled||When Qt is built statically, it creates initializer object libraries for its static plugins. If |
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().
© 2023 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.