comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: [GNAT 2006] Project file and conditional withing/linking
Date: Thu, 08 Jun 2006 20:50:09 +0100
Date: 2006-06-08T20:50:09+01:00	[thread overview]
Message-ID: <m23befo2a6.fsf@grendel.local> (raw)
In-Reply-To: 4epgrmF1g33evU1@individual.net

"Alex R. Mosteo" <devnull@mailinator.com> writes:

> I'm using a project file and, depending on some external variables,
> I want to include some library for linking or not. The library is
> defined in its own project file.
>
> The problem is that withing the library project causes its linker
> options to be added no matter what I try, and I'd like to remove
> these linker options (otherwise the library is always linked).

I don't see why you use Linker_Options? I would have thought you could
do everything with Default_Switches ("ada").

> Conditionally withing seems out of the question: the "with"s are to be at
> the top. I've tried overriding with
>
> for Gtkada.Linker'Default_Switches ("ada") use ();
> for Gtkada.Linker.Linker_Options use ();

No, you can define your own switches, not theirs.

> I could remove the withing and copy the switches to my project file,
> but I'd strongly prefer to keep using the stock installed library
> project file.

We have defined environment-dependent symbols in non-source Projects
and then used the symbols to create the appropriate switches in the
user project. Something like

   package Linker is
     case Use_Other_Package is
       when Yes =>
         for Default_Switches ("ada") 
           use ("-foo") & Other_Package.Linker_Switches;
       when No =>
         for Default_Switches ("ada") use ("-bar");
     end case;
   end Linker;



  parent reply	other threads:[~2006-06-08 19:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-08  2:37 [GNAT 2006] Project file and conditional withing/linking Alex R. Mosteo
2006-06-08 12:19 ` mor3b
2006-06-08 19:50 ` Simon Wright [this message]
2006-06-09  7:45   ` Alex R. Mosteo
2006-06-09  8:08     ` Alex R. Mosteo
replies disabled

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