comp.lang.ada
 help / color / mirror / Atom feed
* Compiler switches for directory in GNAT project files
@ 2011-08-27 17:49 Björn
  2011-08-27 19:50 ` Robert A Duff
  2011-08-27 21:34 ` anon
  0 siblings, 2 replies; 4+ messages in thread
From: Björn @ 2011-08-27 17:49 UTC (permalink / raw)


I have a number of source files in a GNAT project which have been
automatically generated. I want to compile these source files with
different compiler switches from the rest of the project (e.g. less
warnings).

All of the automatically generated files are located in one single
folder. Up until now I've specified them one by one in the project
file: for Switches ("foo.adb") use ... However, the list of specified
files have now grown well over a hundred.

Is there a way to specify specific compiler switches for all files
contained in a specific directory in GNAT project files?

/Björn



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Compiler switches for directory in GNAT project files
  2011-08-27 17:49 Compiler switches for directory in GNAT project files Björn
@ 2011-08-27 19:50 ` Robert A Duff
  2011-08-28  7:24   ` Björn
  2011-08-27 21:34 ` anon
  1 sibling, 1 reply; 4+ messages in thread
From: Robert A Duff @ 2011-08-27 19:50 UTC (permalink / raw)


Bj�rn <ssh9614@hotmail.com> writes:

> Is there a way to specify specific compiler switches for all files
> contained in a specific directory in GNAT project files?

You could create a separate project file for that directory.

- Bob



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Compiler switches for directory in GNAT project files
  2011-08-27 17:49 Compiler switches for directory in GNAT project files Björn
  2011-08-27 19:50 ` Robert A Duff
@ 2011-08-27 21:34 ` anon
  1 sibling, 0 replies; 4+ messages in thread
From: anon @ 2011-08-27 21:34 UTC (permalink / raw)


There asre two ways:

You can use the "Case" statement if you use an external/internal 
variable

  type SRC_Type is ( "default", "easy", "advance" ) ;
  --
  SRC : SRC_Type := external ( "SRC", "default" ) ;

  case SRC is
    when "default" =>
        for Source_Files  use ( "libraries_1.adb", 
                                "print_1.adb",
                                "environment_1.ads" ) ;
    when "easy" =>
        for Source_Files  use ( "libraries_2.adb", 
                                "print_1.adb",
                                "environment_2.ads" ) ;
    when "advance" =>
        for Source_Files  use ( "libraries_3.adb", 
                                "print_2.adb",
                                "environment_1.ads" ) ;
  end case;
  --
  -- or you can use the "for Swiches" statement
  --
  package Compiler is
    for Default_Switches ( "Ada" ) use ( "-gnat95" ) ;  -- default 95 specs
    --
    for Switches ( "Program_1.adb" ) use ( "-gnat05" ) ;  -- Ada 2005 specs
    for Switches ( "Program_2.adb" ) use ( "-gnat12" ) ;  -- using Ada 2012
  end Compiler ;


In <6e8c14b6-efab-44b3-b857-252bfd63744d@n12g2000yqh.googlegroups.com>, =?ISO-8859-1?Q?Bj=F6rn?= <ssh9614@hotmail.com> writes:
>I have a number of source files in a GNAT project which have been
>automatically generated. I want to compile these source files with
>different compiler switches from the rest of the project (e.g. less
>warnings).
>
>All of the automatically generated files are located in one single
>folder. Up until now I've specified them one by one in the project
>file: for Switches ("foo.adb") use ... However, the list of specified
>files have now grown well over a hundred.
>
>Is there a way to specify specific compiler switches for all files
>contained in a specific directory in GNAT project files?
>
>/Bj=F6rn




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Compiler switches for directory in GNAT project files
  2011-08-27 19:50 ` Robert A Duff
@ 2011-08-28  7:24   ` Björn
  0 siblings, 0 replies; 4+ messages in thread
From: Björn @ 2011-08-28  7:24 UTC (permalink / raw)


> You could create a separate project file for that directory.

Yes, I guess this is what I'll do.
I was hoping for some syntax: for Switches ("/*"), but I didn't find
anything when I scanned the user guide.

/Björn



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-08-28  7:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-27 17:49 Compiler switches for directory in GNAT project files Björn
2011-08-27 19:50 ` Robert A Duff
2011-08-28  7:24   ` Björn
2011-08-27 21:34 ` anon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox