I use Qt Creator with custom build system (ninja).
The issue is that the $PATH variable passed to the Qt Creator IDE is absolutely vanilla: /usr/bin:/bin:/usr/sbin:/sbin
.
So I have to write bash -c '/path/to/ninja list of targets'
instead of just ninja list of targets
, or perform build steps in a terminal, not in the IDE.
I tried all known recipes to set up the $PATH.
setenv PATH .....
)sh -c 'launchtcl setenv PATH $PATH:.....'
)The idea of using launch agenes is described in a StackOverflow answer.
None works!
Any arbitrary environment var in my custom .plist file sets correctly, - any but the PATH.
(I have tested it simply: created a custom build step echo xzxzxz=$XZXZXZ path=$PATH
where xzxzxz is also set in my launch agent).
It's interesting that if I launch Qt Creator from bash session ('/Applications/Qt Creator.app/Contents/MacOS/Qt Creator' &
), it gets correct PATH, same as the bash itself.
Also it's interesting that the PATH assigned with the launch agent is later overwritten. There I wrote sh -c 'launchctl setenv PATH $PATH:/HELLOWORLD'
, but I don't see that HELLOWORLD in echo $PATH
.
So, there are a race condition, someone rebuilds the PATH from /etc/paths and /etc/paths.d later.
Thus:
You could just update the path to the build environment of your project inside Qt Creator.
Newer versions (>3.3 AFAIR, 3.4 for certain) allow to set environment overrides in each the kit, so that you could have it for all projects using those.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With