summaryrefslogtreecommitdiffstats
path: root/src/corelib/doc/src/cmake/qt_standard_project_setup.qdoc
blob: 389146a7901ee974e177ac07486dba98112e8433 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/****************************************************************************
**
** Copyright (C) 2021 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_standard_project_setup.html
\ingroup cmake-commands-qtcore

\title qt_standard_project_setup
\target qt6_standard_project_setup

\summary {Setup project-wide defaults to a standard arrangement.}

\include cmake-find-package-core.qdocinc

\preliminarycmakecommand

\section1 Synopsis

\badcode
qt_standard_project_setup()
\endcode

\versionlessCMakeCommandsNote qt6_standard_project_setup()

\section1 Description

This command simplifies the task of setting up a typical Qt application.
It would usually be called immediately after the first \c{find_package(Qt6)}
call, normally in the top level \c{CMakeLists.txt} file and before any targets
have been defined. It does the following things:

\list
\li The standard CMake variables \c{CMAKE_AUTOMOC} and \c{CMAKE_AUTOUIC}
    are set to true if they are not already defined.
    This enables all Qt-related autogen features by default for subsequently
    created targets in the current directory scope and below.
\li CMake's \l{GNUInstallDirs} module is automatically included. This defines
    appropriate defaults for variables like \c{CMAKE_INSTALL_BINDIR},
    \c{CMAKE_INSTALL_LIBDIR}, and so on.
\li When targeting Windows, if the \c{CMAKE_RUNTIME_OUTPUT_DIRECTORY} variable
    is not already set, it will be set to
    \c{${CMAKE_CURRENT_BINARY_DIR}}.
\li When target platforms other than Apple or Windows, \c{CMAKE_INSTALL_RPATH}
    will be augmented as described below.
\endlist

On platforms that support \c{RPATH} (other than Apple platforms), two values
are appended to the \c{CMAKE_INSTALL_RPATH} variable by this command.
\c{$ORIGIN} is appended so that libraries will find other libraries they depend
on in the same directory as themselves. \c{$ORIGIN/<reldir>} is also appended,
where \c{<reldir>} is the relative path from \c{CMAKE_INSTALL_BINDIR} to
\c{CMAKE_INSTALL_LIBDIR}. This allows executables installed to
\c{CMAKE_INSTALL_BINDIR} to find any libraries they may depend on installed to
\c{CMAKE_INSTALL_LIBDIR}. Any duplicates in \c{CMAKE_INSTALL_RPATH} are
removed. In practice, these two values ensure that executables and libraries
will find their link-time dependencies, assuming projects install them to the
default locations the \l{install(TARGETS)} command uses when no destination is
explicitly provided.

The \c{qt_standard_project_setup()} command can effectively be disabled by
setting the \l{QT_NO_STANDARD_PROJECT_SETUP} variable to true.

\sa {qt6_generate_deploy_app_script}{qt_generate_deploy_app_script()}

\section1 Example

\include cmake-deploy-runtime-dependencies.qdocinc
*/