How to source environment variables from a script on a remote host when using remote mode in clion?

Viewed 602

At my company we use a number of linux servers dedicated to compilation of our codebase. I would like to use CLion's remote working capabilities, but so far I am unable to find a way for CLion to source my ~/.bashrc file, which sources other files that set the env and toolchain.

Is there a way to make clion source a file, .bashrc to be specific, after making the ssh connection to the remote server?

2 Answers

I did find a workaround:

I created a bash script that looks like this:

export PATH=/home/user/Qt/5.15.1/gcc_64/bin/:$PATH
/home/user/Documents/cmake-3.19.0-rc3-Linux-x86_64/bin/cmake $@

And set my toolchain's cmake to that file. Now whenever there is a configuration or building operation the script would pick up the arguments, setup the environment and then call cmake with passed parameters.

Unfortunately, as of 13.11.2020 there is no way to source a script from the remote machine while working in CLion remotely via ssh.

There is a ticket for this functionality to be added so if you are reading this in the future, check the web, maybe the situation has changed.

Related