Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting environment variables at Qt Creator by sourcing a shell script

I am trying to configure the "Run Settings" on Qt Creator 3.0.1.

I would like to set the value of many environment variables by sourcing a shell script 'myScript'. However, Deployment's Custom Process Step apparently doesn't accept 'source' as a command.

If I execute the script instead of sourcing it, it sets the environment variables of the shell process in which it is executed, which is not the same where Qt Creator runs the executable.

Is it possible to use 'myScript' to configure the environment variables ? How should I call it?

like image 695
toliveira Avatar asked May 14 '15 20:05

toliveira


People also ask

How to Set environment variable in Qt Creator?

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 Qt Creator is started, select Edit > Preferences > Environment > System, and then select Change in the Environment field.

How do I set an environment variable in Linux shell?

In order to set a permanent environment variable in Bash, you have to use the export command and add it either to your “. bashrc” file (if this variable is only for you) or to the /etc/environment file if you want all users to have this environment variable.

How do I run Qt in terminal?

For console applications, check the Run in terminal check box. To specify the terminal to use on Linux and macOS, select Edit > Preferences > Environment > System. To run with special environment variables set up, select them in the Run Environment section. For more information, see Selecting the Run Environment.


1 Answers

Ofcorse, You can run qt via scrypt. This is very simply. My script is below. Ofcorse you need environment variables in concret file. In my case this file is environment-setup

#!/bin/bash
echo "ustawienie zmiennej /usr/local/angstrom/arm/environment-setup"
# set concret variables important is . /
. /usr/local/angstrom/arm/environment-setup
echo "Uruchomienie qtCreator"
# lunched qtcreator
$HOME/Qt/Tools/QtCreator/bin/qtcreator

You also can set this script as linked to main icon qt in your start menu. After this, all you need to run qt is only click in your shortcut in menu

like image 97
FanQt Avatar answered Nov 07 '22 10:11

FanQt