Next: GUI Editor, Up: Project files [Contents][Index]

### 5.1 Project File Overview

Project files have a simple syntax; they may be edited directly. Each line specifies a project variable name and its value, separated by “=”:

    src_dir=/Projects/my_project/src_1
    src_dir=/Projects/my_project/src_2

Some variables (like `src_dir`) are lists; multiple occurrences are concatenated.

There must be no space between the variable name and “=”, and no trailing spaces.

Alternately, a GUI editor for project files is available (see GUI Editor). It uses Emacs widgets, similar to Emacs customize.

The GUI editor also provides a convenient way to view current project settings, if they have been modified using menu commands rather than by editing the project file.

After the first Ada mode build command is invoked, there is always a current project file, given by the lisp variable `ada-prj-default-project-file`. Currently, the only way to show the current project file is to invoke the GUI editor.

To find the project file the first time, Ada mode uses the following search algorithm:

- If `ada-prj-default-project-file` is set, use that.
- Otherwise, search for a file in the current directory with the same base name as the Ada file, but extension given by `ada-prj-file-extension` (default `".adp"`).
- If not found, search for `*.adp` in the current directory; if several are found, prompt the user to select one.
- If none are found, use `default.adp` in the current directory (even if it does not exist).

This algorithm always sets `ada-prj-default-project-file`, even when the file does not actually exist.

To change the project file before or after the first one is found, invoke ‘`Ada | Project | Load ...`’.

Or, in lisp, evaluate `(ada-set-default-project-file "/path/file.adp")`. This sets `ada-prj-default-project-file`, and reads the project file.

You can also specify a GNAT project file to ‘`Ada | Project | Load ...`’ or `ada-set-default-project-file`. Emacs Ada mode checks the file extension; if it is `.gpr`, the file is treated as a GNAT project file. Any other extension is treated as an Emacs Ada mode project file.

Next: GUI Editor, Up: Project files [Contents][Index]