For example, we can define an aggregate project Agg that groups A, B and C:
aggregate library project Agg is for Project_Files use ("a.gpr", "b.gpr", "c.gpr"); for Library_Name use ("agg"); for Library_Dir use ("lagg"); end Agg;
Then, when you build with:
gprbuild agg.gpr
This will build all units from projects A, B and C and will create a
static library named libagg.a
in the lagg
directory. An aggregate library project has the same set of
restriction as a standard library project.
Note that a shared aggregate library project cannot aggregate a static library project. In platforms where a compiler option is required to create relocatable object files, a Builder package in the aggregate library project may be used:
aggregate library project Agg is for Project_Files use ("a.gpr", "b.gpr", "c.gpr"); for Library_Name use ("agg"); for Library_Dir use ("lagg"); for Library_Kind use "relocatable"; package Builder is for Global_Compilation_Switches ("Ada") use ("-fPIC"); end Builder; end Agg;
With the above aggregate library Builder package, the -fPIC
option will be passed to the compiler when building any source code
from projects a.gpr
, b.gpr
and c.gpr
.