qt_finalize_project

Handles various common platform-specific tasks associated with a Qt project.

Note: This command is in technology preview and may change in future releases.

The command is defined in the Core component of the Qt6 package, which can be loaded like so:

find_package(Qt6 REQUIRED COMPONENTS Core)

This command was introduced in Qt 6.3.

Synopsis

qt_finalize_project()

If versionless commands are disabled, use qt6_finalize_project() instead. It supports the same set of arguments as this command.

Description

Some targets that are created using Qt commands require additional actions at the end of CMake configuring phase. Depending on the platform, the function typically:

  • Walks the build tree.
  • Resolves dependencies.
  • Applies any extra deployment steps.

With CMake version 3.19 or later, you don't need to call this command since it consists of sub-commands that are ordinarily invoked at the end of CMAKE_SOURCE_DIR directory scope processing.

Warning: If your Android project is built using a CMake version lower than 3.19, make sure that you call qt6_finalize_project() at the end of a top-level CMakeLists.txt.

Examples

For projects that use a CMake version lower than 3.19, you need to call qt_finalize_project manually. This example shows the typical use of the function:

cmake_minimum_required(VERSIONS 3.16)

project(MyProject LANGUAGES CXX)

find_package(Qt6 REQUIRED COMPONENTS Core)

qt_add_executable(MyApp main.cpp)
add_subdirectory(mylib)

qt_finalize_project()

See also QT_NO_COLLECT_BUILD_TREE_APK_DEPS and QT_NO_COLLECT_IMPORTED_TARGET_APK_DEPS.

© 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.