Edit environment settings
You can change the environment variable values for build or run environments globally or for a particular project or kit:
- To change values globally, go to Preferences > Environment > System, and select Change in Environment.
- To change values for a project, select Edit or Add in the project, build, or run environment settings.
- To change values for a kit, go to Preferences > Kits > Kits, and select Edit Build Environment or Edit Run Environment in Environment.
Use the following syntax to enter environment variable names and values: <VARIABLE>=<VALUE>
. To temporarily disable a variable, add a hash character (#) to the beginning of the line.
Note: Using this approach for a different statement (append, prepend, unset) may result in unexpected changes of the environment.
To remove a variable value from the environment, enter the variable name. For example, TEST
sets the value of the 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 /opt/bin
folder to the existing PATH:
- On Windows:
PATH=C:\opt\bin;${PATH}
- On Linux:
PATH=/opt/bin:${PATH}
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 add a comment or disable any of the above actions, prefix it with two hash characters (##).
See also Specify the environment for projects, Configure projects for building, Configure projects for running, Use Qt Creator variables, and Kits.