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
.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
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.
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 to use for a kit in Projects > Build Settings > 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.
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.
To run in a clean system environment, select Clean Environment.
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.
© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.