IDE Variables


In the IDE you can define so called IDE variables. Here I will describe one good place to use such a variable.

Over time most programmers, teams, companies, etc build up a set of software packages, which are used in many projects. Sometimes these packages are simply copied from one project to another, but this leads to many copies of (nearly) the same software. And each time you find a bug or make an improvement you have to make it many places.

Eventually, you decide to share these packages instead of copying them. I.e. you will only have one copy of these packages on the disk. This means that the packages will lie outside the projects, rather than inside them.

You will discover that it is not a good idea to reference such shared packages by an absolute path (like c:\sharedTools\tool1\tool1.pack), because that fixes the placement on the disk, which makes restructuring of the disk difficult and all team members will need an identical disk layout.

Instead, you may use relative paths (like ..\sharedTools\tool1\tool1.pack), this is a little better, because you can at least choose a different top level directory (and therefore for example different disk drive).

But still the placement of the tools is locked relative to the projects, and this has some of the same drawbacks as the fixed placement approach above, only a little less limiting.

As an example you can use an IDE variable to increase the flexibility, i.e. let us name the file $(Tools)\tool1\tool1.pack. To do this you must define the IDE variable $(Tools) and then you must make $(Tools) an include directory in the project settings.

When the include paths use IDE Variables, the project tree will also reflect this.

If you decide to move the shared Tools to another place, you can just do it and then redefine the $(Tools) variable. IDE variables are shared across all projects, so this update only has to be done once to work for all projects. Different people in a team can have the tools directory in different places, because each person has their own $(Tools) variable.

This strategy has long been used for the IDE variable $(ProDir) which always points to the Visual Prolog installation directory of the current compiler.