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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
/****************************************************************************
**
** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Creator documentation.
**
** 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.
**
****************************************************************************/
/*!
\previouspage creator-build-dependencies.html
\page creator-project-settings-environment.html
\nextpage creator-custom-output-parsers.html
\title Specifying Environment Settings
You can specify the environment you want to use for building
a project in the \uicontrol {Build Environment} section of
the \uicontrol {Build Settings}.
By default, the environment in which \QC was started is used and modified
to include the Qt version. Depending on the selected Qt version, \QC
automatically sets the necessary environment variables. You can edit
existing environment variables or add, reset and unset new variables
based on your project requirements.
To globally change the system environment from the one in which
\QC is started, select \uicontrol Tools > \uicontrol Options >
\uicontrol Environment > \uicontrol System, and then select
\uicontrol Change in the \uicontrol Environment field.
\image qtcreator-options-environment-system.png "Environment options System tab"
In addition, you can specify custom environment variables in the
\uicontrol {Project Settings} > \uicontrol Environment settings.
They are added to all build environments. The final build environment
is specified separately for each kit. The project-specific environment
settings enable you to amend the build environment for all kits that
you use to build the project simultaneously, rather than having to edit
it separately for each kit.
\image qtcreator-build-environment.png "Build Environment"
The changes are stored in the local project specific \c{CMakeLists.txt.user}
or \c{.pro.user} file, depending on the build system you use. Therefore,
they are not suitable for sharing between developers or development PCs. To
share settings, incorporate them into the build system. For example, if you
use CMake, make the changes in the \c {CMakeLists.txt} file, and if you use
qmake, make the changes in the \c{.pro} file.
\section1 Batch Editing
To modify environment variable values for build or run environments,
select \uicontrol {Batch Edit} in the \uicontrol {Build Environment}
or \uicontrol {Environment} pane and enter environment variables in
the \uicontrol {Edit Environment} dialog.
To remove a variable value from the environment, enter the variable name.
For example, \c TEST sets the value of the \c TEST variable empty when
building or running the project.
To add a variable value to the environment, enter the variable name and
value, separated by the equals sign. For example, the following line
prepends the \c /opt/bin folder to the existing PATH:
\list
\li On Windows: \c {PATH=C:\opt\bin;${PATH}}
\li On Linux: \c {PATH=/opt/bin:${PATH}}
\endlist
To add or remove several variables, place them on separate lines. The order
is important. If you remove a value on a line, you cannot refer to it on the
following lines. However, you can remove a value after you have referred to
it on an earlier line.
To temporarily disable a variable, add a hash character (#) to the beginning
of the line.
\section1 Clearing the System Environment
To build with a clean system environment, select the \uicontrol {Clear
system environment} check box. \QC discards the current environment, and
populates a clean system environment with the environment variables that
the compilers and tools need. Therefore, the environment is never totally
empty, even after you clear it.
\section1 Using Environment Variables
You can use any environment variables in build, deploy, and run
configurations. For a list of variable names, select \uicontrol {Build
Settings} > \uicontrol {Build Environment} > \uicontrol Details.
Environment variables are referenced using the native syntax: $VARNAME
or ${VARNAME} on Unix and %VARNAME% on Windows.
\include qtcreator-variables.qdocinc qtcreator variables
*/
|