From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,a02622021d090376 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!news2.volia.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Alex R. Mosteo" Newsgroups: comp.lang.ada Subject: Re: [GNAT 2006] Project file and conditional withing/linking Date: Fri, 09 Jun 2006 09:45:40 +0200 Message-ID: <4esn72F1gdphpU1@individual.net> References: <4epgrmF1g33evU1@individual.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: individual.net NvgtbXeDQEHSgmB3aDLTyQDYs+rwJvRagX6MgSQ7pSxMEH2y4= User-Agent: KNode/0.10.2 Xref: g2news2.google.com comp.lang.ada:4720 Date: 2006-06-09T09:45:40+02:00 List-Id: Simon Wright wrote: > "Alex R. Mosteo" 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"). Actually, the previous GtkAda version used Default_Switches and current one uses Linker_Options. I don't know the reason nor the implications. In any case, I'm just using the installed GtkAda project files. >> 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; I used to do this with the GAP 2005 release, but it seems the GAP/GPL 2006 release will pass the linker options to gnatlink no matter what, once you with the project. Maybe this is the difference between Default_Switches and Linker_Options. Going to set up a test case. Certainly, there are several solutions when you have control over all the project files. I'm attempting to find a solution without modifying the GtkAda stock project file.