Linux environment variable not recognized by qmake in QtCreator -
i'm facing problem project need retrieve environment variable link external libraries, works correctly on windows. in linux looks qmake (run qtcreator) isn't able "decode" environment variable i've set in .bashrc, declared this
export projectsdir=/home/il_mix/projects/
to better define problem, i've made veeery minimalistic .pro file, contains this
message($$(projectsdir))
if run qmake terminal command
/opt/qt/5.9.1/gcc_64/bin/qmake test.pro
i correct output
project message: /home/il_mix/projects/
when open .pro qtcreator, empty project message
instead.
from qtcreator options see 1 , kit has "qmake location" set /opt/qt/5.9.1/gcc_64/bin/qmake
, same i've used terminal.
i've noticed on projects settings, under build/run environment, 1 can see available variables. "projectsdir" not listed in available environment (build, system). on windows environment variable instead listed, , recognized qmake.
is there other setting i'm missing let environment variables work under qtcreator?
here output qmake -v
qmake version 3.1 using qt version 5.9.1 in /opt/qt/5.9.1/gcc_64/lib
i solved problem.
qtcreator looks system-wide environment variables, while ones set in .bashrc or .bash_profile valid user.
to set system-wide environment variable 1 can add /etc/environment
. following example, have append line file
projectsdir=/home/il_mix/projects
then qtcreator recognize variable.
to more multi-user friendly 1 can set variable in '/etc/profile` instead. way environment variable can contain environment variable, like
export projectsdir=$home/projects
i suppose different behavior due fact files (/etc/environment
, /etc/profile
) sourced in different time.
Comments
Post a Comment