Next: , Previous: Packages in Project Files, Up: GNAT Project Manager


11.10 Variables from Imported Projects

An attribute or variable defined in an imported or parent project can be used in expressions in the importing / extending project. Such an attribute or variable is denoted by an expanded name whose prefix is either the name of the project or the expanded name of a package within a project.

       with "imported";
       project Main extends "base" is
          Var1 := Imported.Var;
          Var2 := Base.Var & ".new";
     
          package Builder is
             for Default_Switches ("Ada")
                 use Imported.Builder'Ada_Switches &
                     "-gnatg" &
                     "-v";
          end Builder;
     
          package Compiler is
             for Default_Switches ("Ada")
                 use Base.Compiler'Ada_Switches;
          end Compiler;
       end Main;

In this example: