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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,67e3620b7774a162 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.205.139.10 with SMTP id iu10mr297026bkc.4.1325838788990; Fri, 06 Jan 2012 00:33:08 -0800 (PST) Path: cj8ni57507bkb.0!nntp.google.com!news1.google.com!volia.net!news2.volia.net!feed-A.news.volia.net!news.musoftware.de!wum.musoftware.de!news.swapon.de!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: How to get GNAT version during build process Date: Fri, 06 Jan 2012 08:32:00 +0000 Organization: A noiseless patient Spider Message-ID: References: <17cd8808-bbcf-4c15-b0a1-de4bf7a110b4@p16g2000yqd.googlegroups.com> Mime-Version: 1.0 Injection-Info: mx04.eternal-september.org; posting-host="dFCm8HWntFqmDIilBLqEJQ"; logging-data="4371"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19U7pyc/mYkS91itCgNf2BPAgNppHvRdP8=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (darwin) Cancel-Lock: sha1:Et8pro1Cr+i0hdgWYYT012pTvx0= sha1:oOeQcowa9u+x4//2aSqgFzBR8TM= Content-Type: text/plain; charset=us-ascii Date: 2012-01-06T08:32:00+00:00 List-Id: Jerry writes: > How would one discover the version of GNAT used in a build? I'm > inquiring for someone using cmake. They have cobbled something > together but I get the feeling it is too brittle and requires manual > updating from time to time. Here is the patch that someone submitted: > > > diff -up plplot-5.9.9/cmake/modules/ada.cmake.gnat plplot-5.9.9/cmake/ > modules/ada.cmake > --- plplot-5.9.9/cmake/modules/ada.cmake.gnat 2011-10-12 > 18:43:01.000000000 -0600 > +++ plplot-5.9.9/cmake/modules/ada.cmake 2012-01-04 08:58:11.501470982 > -0700 > @@ -43,7 +43,7 @@ if(ENABLE_ada) > endif(ENABLE_ada) > > if(ENABLE_ada) > - find_library(GNAT_LIB NAMES gnat gnat-4.5 gnat-4.4 gnat-4.3 > gnat-4.2 gnat-4.1) > + find_library(GNAT_LIB NAMES gnat gnat-4.7 gnat-4.6 gnat-4.5 > gnat-4.4 gnat-4.3 gnat-4.2 gnat-4.1) > if(NOT GNAT_LIB) > message(STATUS "WARNING: " > "gnat library not found. Disabling ada bindings") > > > I stumbled across > GNAT.Compiler_Version (g-comver.ads) > in the GNAT library but when I ran this > > with Ada.Text_IO; use Ada.Text_IO; > with GNAT.Compiler_Version; > procedure ada_version is > package CVer is new GNAT.Compiler_Version; > use Cver; > begin > Put_Line(Version); > end ada_version; > > all I got was this > > GPL 2010 (20100603) > > whereas g-comver.ads promises a result in this format > > v.vvx (yyyyddmm)" > > where v.vv would be something like 3.16. You would have thought that cmake's find_library() would have found libgnat; here, GNAT GPL 2011 gives (in lib/gcc/x86_64-apple-darwin10.2.0/4.5.3/adalib) $ ls -l libgnat* -rwxr-xr-x@ 1 simon simon 3886280 19 Apr 2011 libgnat-2011.dylib -rw-r--r--@ 1 simon simon 5321016 19 Apr 2011 libgnat.a lrwxr-xr-x@ 1 simon simon 18 19 Apr 2011 libgnat.dylib -> libgnat-2011.dylib Perhaps it doesn't like symlinks. The comment in g-comver.ads is wrong even with 4.6.0: it just returns "4.6.0". I suppose we could continue the fragility by adding gnat-2010 gnat-2011 etc to the proposed patch!