qt_finalize_target

Handles various common platform-specific tasks associated with Qt targets.

命令的定义在 核心 组件对于 Qt6 包,可以像这样加载:

find_package(Qt6 REQUIRED COMPONENTS Core)
					

该命令在 Qt 6.2 引入。

概要

qt_finalize_target(target)
					

无版本命令 被禁用,使用 qt6_finalize_target() 代替。它支持如此命令的一组相同自变量。

描述

After a target is created, further processing or finalization steps are sometimes needed. The steps to perform depend on the platform, the type of target, and on various properties of the target. These steps are expected to be performed within the same directory scope as the one in which the target was created, so this command should also be called from that same directory scope.

This command is ordinarily invoked as part of a call to qt_add_executable() , qt_add_library() ,或 qt_add_plugin() . The timing of when that call takes place and when a project might need to call it explicitly, is discussed in the documentation of those commands.

Executable Targets

For executable targets, qt_finalize_target() implements the logic described in the subsections below, as appropriate for the platform and target provided. Later Qt releases may expand finalization processing further.

所有平台

Some internal processing is performed to facilitate automatic linking of Qt plugins. This is especially important if using a statically built Qt or a CMake version earlier than 3.21.

Android

  • Generate a deployment settings file for the target .
  • Create a build target for generating an APK.

WASM

创建 ${target}.html (a target-specific wasm_shell.html file), qtloader.js ,和 qtlogo.svg files in the CMAKE_CURRENT_BINARY_DIR .

iOS

Finalization attempts to provide sensible values for the following target properties if they are not already set, and their corresponding CMAKE_... variable is also not set:

  • XCODE_ATTRIBUTE_DEVELOPMENT_TEAM
  • XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER
  • MACOSX_BUNDLE_GUI_IDENTIFIER

If required, the QT_NO_SET_XCODE_DEVELOPMENT_TEAM_ID variable can be used to disable setting XCODE_ATTRIBUTE_DEVELOPMENT_TEAM ,和 QT_NO_SET_XCODE_BUNDLE_IDENTIFIER variable can be used to disable setting XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER and MACOSX_BUNDLE_GUI_IDENTIFIER .

Library Targets

As of this Qt version, finalization for library targets does not perform any processing. Future Qt versions may add finalization processing for libraries, so you should ensure finalization is still invoked in the expected way.

另请参阅 qt_set_finalizer_mode() .