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


10.9 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 prefixed with the name of the project and (if relevant) the name of package where it is defined.

       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: