Clion or cmake does not see environment variable

A.Sizov picture A.Sizov · Jun 6, 2016 · Viewed 19.8k times · Source

I'm using CLion IDE, Cmake and trying to write Hello world using CERN ROOT library.

CMakeLists.txt:

message(STATUS $ENV{ROOTSYS})

~/.bashrc:

export ROOTSYS="$HOME/tools/root-build/"

During build in CLion $ENV{ROOTSYS} is empty by some reason. But $ENV{PATH} returns correct $PATH.

What I did wrong?

Answer

Tsyvarev picture Tsyvarev · Jun 6, 2016

From CLion developers FAQ:

Q: How to pass environment variables and parameters to CMake in CLion?

A: The best way is to use Preferences/Settings | Build, Execution, Deployment | CMake dialog.

As for .bashrc file, it is only used by bash. CLion doesn't need to use bash for run configuration process.