From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: =?UTF-8?Q?Bj=c3=b6rn_Lundin?= Newsgroups: comp.lang.ada Subject: Re: Checking for OS in gnatstudio project file(.gpr) Date: Thu, 18 Jun 2020 18:44:17 +0200 Organization: A noiseless patient Spider Message-ID: References: <5eeb50d9$0$1208$e4fe514c@news.kpn.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Thu, 18 Jun 2020 16:44:17 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="4c33024af757325f148a2ece94d68464"; logging-data="5180"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18H3UrIN47ZaJDIvXJCes+R" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 Cancel-Lock: sha1:bdEELpWq4N2bOs2oAagGDhZM2Hs= In-Reply-To: <5eeb50d9$0$1208$e4fe514c@news.kpn.nl> Content-Language: sv Xref: reader01.eternal-september.org comp.lang.ada:59122 List-Id: Den 2020-06-18 kl. 13:32, skrev ldries46: > I em in neede for a possibility to check within a .gpr file which > operating system is runnung. Is there a way to do that? So I can use the > same project file without changing  the .gpr file when compiling a > program on different OS'ses. As others have replied you can use scenario variables. And they are passed from commandline. But gprbuild looks for variables passed in with -X like -XVARIBLE=Value however if that is not found it will look for that name amomg the environent variables so I create env vars for current os/arch/db in the os and test on every combination needed db_libs := (); case db is when Oracle => db_libs := db_lib1; when Postgresql => db_libs := db_lib2; when sqlserver => db_libs := db_lib3; end case other_libs := (): case os_arch is when AIX_PPC => other_libs := lib1; when Linux_x64 => other_libs := lib2; when Linux_arm => other_libs := lib3; when Win_64 => other_libs := lib4; end case and so on the use db_libs and other-libs elsewhere in the gprfile -- Björn