Specify the environment for projects
The environment for a project is determined according to a settings hierarchy:
By default, the environment in which Qt Creator was started is used and modified to include the Qt version. Depending on the selected Qt version, Qt Creator automatically sets the necessary environment variables. You can edit existing environment variables or add, reset and unset new variables based on your project requirements.
The final environment is specified separately for each kit. With project-specific environment settings you can change the environment for all kits that you use to build, deploy, and run the project simultaneously, rather than having to change it separately for each kit.
The changes are stored in the local project-specific CMakeLists.txt.user
or .pro.user
file, depending on the build system you use, such as CMake or qmake. 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 CMakeLists.txt
file, and if you use qmake, make the changes in the .pro
file.
Globally change the environment
To globally change the environment from the one in which Qt Creator is started, select Preferences > Environment > System, and then select Change in the Environment field.
Change the environment for a project
To change the system environment for a project from the one in which Qt Creator is started, select Projects > Project Settings > Environment.
Specify the build environment
Specify the build environment to use for a kit in Projects > Build Settings > Build Environment.
Clear the build environment
To build with a clean system environment, select the Clear system environment check box. Qt Creator 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.
Specify the run environment
Qt Creator automatically selects the environment used for running the application based on the device type. You can edit the environment or select another environment in Projects > Run Settings > Environment.
You can edit existing environment variables or add, reset and unset new variables.
When running on the desktop, the Build Environment is used by default, but you can also use the System Environment without the additions made to the build environment.
To modify the environment variable values for the run environment, double-click environment variables or their values and change them inline, or select Batch Edit to change several variable values at a time.
Clean the run environment
To run in a clean system environment, select Clean Environment.
Run on devices
When running on a mobile device connected to the development host, Qt Creator fetches information about the Device Environment from the device. Usually, it does not make sense to edit the device environment.
See also Batch edit environment settings, Specifying Build Settings, Specifying Run Settings, and Use Qt Creator variables.