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=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED.IIfIc3CB/+nKo+wKq8+a0g.user.gioia.aioe.org!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Checking for OS in gnatstudio project file(.gpr) Date: Fri, 19 Jun 2020 17:43:43 +0100 Organization: Aioe.org NNTP Server Message-ID: References: <5eeb50d9$0$1208$e4fe514c@news.kpn.nl> NNTP-Posting-Host: IIfIc3CB/+nKo+wKq8+a0g.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (darwin) X-Notice: Filtered by postfilter v. 0.9.2 Cancel-Lock: sha1:kPnReQN/fcS8LqJlr1BgWIEyzj4= Xref: reader01.eternal-september.org comp.lang.ada:59130 List-Id: ldries46 writes: > 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. Alire settled on this[1] in an aggregate project after some heartsearching: Host_OS := external ("OS", "default"); -- On Windows an OS environment variable is defined, we can use it to -- determine if we are compiling on Windows. -- -- On macOS, the nearest equivalent is OSTYPE; however this is -- e.g. "darwin18", so not useful here. Set "macOS" by hand. -- ALIRE_OS is used in alire_common.gpr. -- GNATCOLL_OS is used in gnatcoll.gpr. case Host_OS is when "Windows_NT" => for External ("ALIRE_OS") use "windows"; for External ("GNATCOLL_OS") use "windows"; when "macOS" => for External ("ALIRE_OS") use "osx"; for External ("GNATCOLL_OS") use "osx"; when others => for External ("ALIRE_OS") use "unix"; for External ("GNATCOLL_OS") use "unix"; end case; but I've had a lot of trouble with aggregate projects (I don't think I've grasped what the use cases are). As I remember, it was package Builder that was the issue. [1] https://github.com/alire-project/alire/blob/master/alr_env.gpr#L22