summaryrefslogtreecommitdiffstats
path: root/src/corelib/doc
diff options
context:
space:
mode:
authorAlexey Edelev <alexey.edelev@qt.io>2022-01-26 12:26:06 +0100
committerAlexey Edelev <alexey.edelev@qt.io>2022-02-02 22:37:33 +0100
commit63f79d7ffb22de89a2c6314caa5b5a1908590063 (patch)
tree518300179caf0ba6be6edaf911d9b7c012c24d54 /src/corelib/doc
parentf84206ba6962a6ad735787cac6313223238f5d4a (diff)
Add documentation for qt_finalize_project command
Task-number: QTBUG-100207 Pick-to: 6.3 Change-Id: I902ae827efad422771494ae3ad2da48d48d5c9cb Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'src/corelib/doc')
-rw-r--r--src/corelib/doc/snippets/cmake-macros/examples.cmake13
-rw-r--r--src/corelib/doc/src/cmake/qt_add_executable.qdoc10
-rw-r--r--src/corelib/doc/src/cmake/qt_android_add_apk_target.qdoc3
-rw-r--r--src/corelib/doc/src/cmake/qt_finalize_project.qdoc71
-rw-r--r--src/corelib/doc/src/includes/cmake-android-qt-finalize-project-warning.cmake3
5 files changed, 97 insertions, 3 deletions
diff --git a/src/corelib/doc/snippets/cmake-macros/examples.cmake b/src/corelib/doc/snippets/cmake-macros/examples.cmake
index a4def96600..31cf4811e0 100644
--- a/src/corelib/doc/snippets/cmake-macros/examples.cmake
+++ b/src/corelib/doc/snippets/cmake-macros/examples.cmake
@@ -57,3 +57,16 @@ qt_finalize_target(complexapp)
qt_android_generate_deployment_settings(myapp)
qt_android_add_apk_target(myapp)
#! [qt_android_deploy_basic]
+
+#! [qt_finalize_project_manual]
+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()
+#! [qt_finalize_project_manual]
diff --git a/src/corelib/doc/src/cmake/qt_add_executable.qdoc b/src/corelib/doc/src/cmake/qt_add_executable.qdoc
index 3ff0b9ba85..01ffc2604f 100644
--- a/src/corelib/doc/src/cmake/qt_add_executable.qdoc
+++ b/src/corelib/doc/src/cmake/qt_add_executable.qdoc
@@ -85,7 +85,10 @@ for you as a convenience.
After a target is created, further processing or \e{finalization} steps are
commonly needed. The steps to perform depend on the platform and on various
properties of the target. The finalization processing is implemented by the
-\l{qt6_finalize_target}{qt_finalize_target()} command.
+\l{qt6_finalize_target}{qt_finalize_target()} command. You might need to also
+call the \l{qt6_finalize_project}{qt_finalize_project()} command at the end
+of top-level CMakeLists.txt to correctly resolve the dependencies between
+project targets.
Finalization can occur either as part of this call or be deferred to sometime
after this command returns (but it should still be in the same directory scope).
@@ -102,7 +105,8 @@ not be needed unless the project has to support CMake 3.18 or earlier.
\sa {qt6_finalize_target}{qt_finalize_target()},
{qt6_set_finalizer_mode}{qt_set_finalizer_mode()},
- {qt6_add_library}{qt_add_library()}
+ {qt6_add_library}{qt_add_library()},
+ {qt6_finalize_project}{qt_finalize_project()}
\section1 Examples
@@ -120,4 +124,6 @@ support using CMake versions earlier than 3.19, we take over responsibility
for finalizing the target by adding the \c{MANUAL_FINALIZATION} keyword.
\snippet cmake-macros/examples.cmake qt_add_executable_deferred
+
+\include cmake-android-qt-finalize-project-warning.cmake
*/
diff --git a/src/corelib/doc/src/cmake/qt_android_add_apk_target.qdoc b/src/corelib/doc/src/cmake/qt_android_add_apk_target.qdoc
index aecd219ede..4950346f8f 100644
--- a/src/corelib/doc/src/cmake/qt_android_add_apk_target.qdoc
+++ b/src/corelib/doc/src/cmake/qt_android_add_apk_target.qdoc
@@ -66,7 +66,8 @@ respectively, which will be created automatically. Creating of the \c{apk} and
\c{QT_NO_GLOBAL_AAB_TARGET} variables to \c{TRUE}.
\sa {qt6_android_generate_deployment_settings}{qt_android_generate_deployment_settings()},
- {qt6_finalize_target}{qt_finalize_target()}
+ {qt6_finalize_target}{qt_finalize_target()},
+ {qt6_finalize_project}{qt_finalize_project()}
\section1 Example
diff --git a/src/corelib/doc/src/cmake/qt_finalize_project.qdoc b/src/corelib/doc/src/cmake/qt_finalize_project.qdoc
new file mode 100644
index 0000000000..8a8c670176
--- /dev/null
+++ b/src/corelib/doc/src/cmake/qt_finalize_project.qdoc
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2022 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page qt_finalize_project.html
+\ingroup cmake-commands-qtcore
+
+\title qt_finalize_project
+\target qt6_finalize_project
+
+\summary {Handles various common platform-specific tasks associated with Qt project.}
+\preliminarycmakecommand
+
+\include cmake-find-package-core.qdocinc
+
+\cmakecommandsince 6.3
+
+\section1 Synopsis
+
+\badcode
+qt_finalize_project()
+\endcode
+
+\versionlessCMakeCommandsNote qt6_finalize_project()
+
+\section1 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 through the build tree, resolves dependencies between targets
+created by the user, and applies extra deployment steps.
+
+With CMake versions 3.19 and higher, you don't need to call this command since
+it consists of sub-commands that are ordinarily invoked at the end of
+\c CMAKE_SOURCE_DIR scope.
+
+\include cmake-android-qt-finalize-project-warning.cmake
+
+\section2 Examples
+
+For projects that use a CMake version lower than 3.19, you need to call
+\c qt_finalize_project manually. This example shows the typical use of the
+function:
+
+\snippet cmake-macros/examples.cmake qt_finalize_project_manual
+
+*/
diff --git a/src/corelib/doc/src/includes/cmake-android-qt-finalize-project-warning.cmake b/src/corelib/doc/src/includes/cmake-android-qt-finalize-project-warning.cmake
new file mode 100644
index 0000000000..12fc7a1e14
--- /dev/null
+++ b/src/corelib/doc/src/includes/cmake-android-qt-finalize-project-warning.cmake
@@ -0,0 +1,3 @@
+\warning If your \e Android project is built using a CMake version lower than
+3.19, make sure that you call \l{qt_finalize_project}{qt6_finalize_project()} at
+the end of a top-level CMakeLists.txt.