Skip to content

Commit 803374f

Browse files
committed
Allow the user to set build flags
1 parent e53c63e commit 803374f

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

lib/gnat/aunit.gpr

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ project AUnit is
2929
when "dynamic" | "relocatable" =>
3030
for Library_Kind use "relocatable";
3131
for Library_Version use AUnit_Shared.Library_Version;
32+
-- Put options like --as-needed before the libraries.
33+
for Leading_Library_Options use AUnit_Shared.Ldflags;
3234
end case;
3335

3436
--------------
@@ -41,12 +43,15 @@ project AUnit is
4143
for Default_Switches ("ada") use
4244
("-g", "-gnatQ", "-O1", "-gnatf", "-gnato",
4345
"-gnatwa.Xe", "-gnaty");
44-
4546
when "Install" =>
4647
for Default_Switches ("ada") use
4748
("-O2", "-gnatp", "-gnatn", "-gnatwa.X");
4849
end case;
4950

51+
-- Allow user flags to override default flags.
52+
for Default_Switches ("ada") use
53+
Compiler'Default_Switches ("ada") & AUnit_Shared.Adaflags;
54+
5055
for Switches ("aunit.adb") use
5156
Compiler'Default_Switches ("ada") & ("-fno-strict-aliasing");
5257
end Compiler;

lib/gnat/aunit_shared.gpr

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ project AUnit_Shared is
3030
Library_Dir := External ("AUNIT_LIBDIR", "../aunit/" & Subdir);
3131
Object_Dir := External ("AUNIT_OBJDIR", "../aunit-obj/" & Subdir);
3232

33+
Adaflags := External_As_List ("ADAFLAGS", " ");
34+
Ldflags := External_As_List ("LDFLAGS", " ");
35+
3336
for Source_Dirs use ();
3437

3538
type Exception_Type is ("fullexception", "certexception", "zfpexception");

0 commit comments

Comments
 (0)