CLion 2017.3 Help

Path Variables

Introduction

To avoid complications when moving projects from one computer to another, CLion provides path variables. (A path variable, obviously, is a variable whose value is an absolute path to a directory or file.)

Path variables are particularly useful when working with third-party libraries stored outside the project directory.

To illustrate, let’s assume there is a project shared among a team of developers (e.g., through version control), and there is a library in this project defined at the project level.

Everything goes fine if the library is located under the project content root. This, however, is rarely the case.

A more typical situation is when the library location is external to the projects. Such a library is referenced by its absolute path and there’s no guarantee that this path is the same on every one of the computers used by the team.

The obvious solution is to define a path variable for the library location. In such a case, the library path may be set individually on each of the computers.

To summarize, you should define path variables under the following set of conditions:

  • There are third-party libraries in your project defined at the project level.
  • These libraries are stored outside the project content root.
  • There is a need to work with the project on more than one computer (e.g., share the project among the development team members through version control).

Ignored variables

If when opening a project, CLion detects unresolved path variables, it asks you to define proper values for them. If for some reason you don’t want to do that (e.g., you are not going to use the corresponding library or libraries), you have an option of adding the corresponding variables to a list of ignored variables.

There may also be other cases when the list of ignored variables is useful.

At the internal level, path variables are represented by strings in which the name of a variable is enclosed between a pair of dollar sign characters, for example, $MY_PATH_VARIABLE$.

Such a pattern, in principle, may occur in your project without the meaning of a path variable.

To tell CLion that a string that starts and ends with a dollar sign character (e.g., $SOME_STRING$), actually, is not a path variable, you should add such a string (e.g., SOME_STRING) to the list of ignored variables.

Last modified: 27 March 2018