einpoklum
einpoklum

Reputation: 132260

With CLion, how do I set an environment variable for the cmake build?

I'm new to CLion; and have imported a CMakeLists.txt project. To properly configure, I need to set a certain environment variable.

Now, I know I can do this by setting that variable before invoking CLion; but assuming that I haven't, or that I want to change things at runtime - can I do so? If I can, then how? I still don't know my way around the IDE.

Upvotes: 1

Views: 5809

Answers (2)

asikorski
asikorski

Reputation: 922

According to 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.

So: File > Settings > Build, Execution, Deployment > CMake

There's Environment field in the dialog.

Upvotes: 3

einpoklum
einpoklum

Reputation: 132260

Do the following:

  1. Start a build, or other get the CMake console pane on your Window
  2. To the pane's left, there should be two columns of icons.
  3. Choose the gear-wheel icon
  4. Choose CMake Settings
  5. Now you get a dialog where you can set either environment variables or CMake command-line parameters (which could involve definition, e.g. -DCMAKE_BUILD _TYPE and so on)

That should do it.

Upvotes: 0

Related Questions