🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.c
Article #309644

Re: Automatyczna informacja o wersji

#309644
From: Marcin Konarski
Date: Sun, 04 Feb 2018 18:27
35 lines
2215 bytes
On Wed, 31 Jan 2018 14:18:46 +0100,
Borneq <borneq@antyspam.hidden.pl> wrote:
> W dniu 31.01.2018 o 13:58, Adam Wysocki pisze:
>> Wszystko zajęło mi 4 sekundy. Przejrzenie odpowiedzi na SO to kolejne 25
>> sekund.
>
> Tutaj mamy perl i awk, a ja chciałbym GnuC+CMake
> Jak to zrobiłem:
> pierwszym problem jest to że zmienna preprocesora jest bez znaków 
> cudzysłowu.
> Więc nie można zrobić string commitver = GIT_SHA1;
> Trzeba się posłużyć "tajemniczym" idiomem:
>
> #define xstr(s) str(s)
> #define str(s) #s
> string commitver = xstr(GIT_SHA1);
>
> Teraz, jak ustawić GIT_SHA1 w CMake? (jeszcze nie wiem, jak ustawić dla 
> gita w środowisku CodeBlocks)

Możesz podejżeć jak ja to zrobiłem:
https://github.com/AmokHuginnsson/yaal/blob/c48c6d61072a9b6a2f98d354562fc6786da89509/_aux/cmake/common.cmake#L306
Ugólnie wszystko w _aux co ma w sobie frazę commit-id lub update-commit-id.

https://github.com/AmokHuginnsson/yaal/blob/master/_aux/update-commit-id.cxx

[for Unix]
https://github.com/AmokHuginnsson/yaal/blob/master/_aux/update-commit-id
https://github.com/AmokHuginnsson/yaal/blob/master/_aux/commit-id

-- 
  Amok Huginnsson
GCS d? s:+ a C+++$() UBLS++++$ P L++++$ E---
W++(-) N++ w--- O M- V- PS+ PE++ Y PGP
t--- 5-- X- R !tv b++ DI+++ D+ G e* h+ r- y**
Technical Details
Message-ID: <slrnp7ek4b.73f.amok@vegeta.utgard.biz>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!.POSTED!not-for-mail
References: <p4qnqo$kp4$1@node2.news.atman.pl> <p4sehh$1qv$1$gof@news.chmurka.net> <p4sfnm$8lk$1@node2.news.atman.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!.POSTED!not-for-mail
From: Marcin Konarski <amok@codestation.org>
Newsgroups: pl.comp.lang.c
Subject: Re: Automatyczna informacja o wersji
Date: Sun, 4 Feb 2018 18:27:23 +0000 (UTC)
Organization: ATMAN - ATM S.A.
Lines: 35
Message-ID: <slrnp7ek4b.73f.amok@vegeta.utgard.biz>
References: <p4qnqo$kp4$1@node2.news.atman.pl> <p4sehh$1qv$1$gof@news.chmurka.net> <p4sfnm$8lk$1@node2.news.atman.pl>
Reply-To: marcin.konarski+usenet.cutit@gmail.com
NNTP-Posting-Host: 178-36-16-12.adsl.inetia.pl
Mime-Version: 1.0
X-Trace: node2.news.atman.pl 1517768843 19135 178.36.16.12 (4 Feb 2018 18:27:23 GMT)
X-Complaints-To: usenet@atman.pl
NNTP-Posting-Date: Sun, 4 Feb 2018 18:27:23 +0000 (UTC)
User-Agent: slrn/1.0.3 (Linux)
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit