TamaMcGlinn
TamaMcGlinn

Reputation: 3238

How do you specify the name of the executable in your gprfile? Can it be above the gprfile's directory?

This information is available elsewhere but not consolidated to this particular use-case, hence I felt the need for a stackoverflow self-answer that I (and others) can refer to. Feel free to add your own answers if there is anything I have missed.

project some_project is
   for Source_Dirs use ("src");
   for Object_Dir use "obj";
   for Main use ("main.adb");

   package Compiler is
      for Default_Switches ("ada") use ("-O1", "-gnatwae");
   end Compiler;
end some_project;

I want to have this generate ../some_program_name.exe. How do I specify the name of the executable this gpr project will generate? Can it be in a directory above?

Upvotes: 3

Views: 599

Answers (1)

TamaMcGlinn
TamaMcGlinn

Reputation: 3238

Add this to your gpr file:

for Exec_Dir use "..";
package Builder is
   for Executable ("main.adb") use "some_program_name";
end Builder;

Note that the .exe suffix is added automatically if you are on windows.

In the same Builder package, only the extension can also be changed

for Executable_Suffix use ".elf";

The information was scattered across Adacore's docs for the GNAT Project Manager.

Upvotes: 6

Related Questions