On 11/12/2012 6:59 AM, a.l.e wrote: > On 11/11/12 10:41 AM, ale rimoldi wrote: >> hi john, >> >>> I've been building Scribus from the high watermark of SVN (1.5) and >>> need to determine what version my currently running edition is from. >>> Using Help-About does not provide me the Subversion version and gives >>> me a date of "1 August 2012" when my system notes I built it 18:33:17 >>> 09/10/12 PDT. >>> >>> Is the Subversion version which Scribus is built from ascertainable >>> from a running instance? If not, is there a file is the staged tree >>> that might reflect it? I built Scribus using Gentoo's portage >>> facility which basically pulls whatever is HEAD at the time I >>> update. In this case, I think I last successfully built on 18:33:17 >>> 09/10/12 PDT. I'm going to go look at the Subversion repository (I >>> hope there is a websvn (http://websvn.tigris.org/) interface) and >>> determine what version was HEAD around that time. >>> >>> It seems to me having a Subversion version and date included in the >>> About box might be helpful. >> this has been discussed a few times already, but (afaik) nobody brought >> a usable solution. >> >> another useful feature, would be to add the git branch, for the ones >> who compile from gif. >> >> the main question is: how can we hack the cmake scripts to >> automatically add such information? >> > i've done a short google search. > > here are some links worth to be considered... > > - > http://stackoverflow.com/questions/657850/cmake-how-to-use-bash-command-in > -cmakelists-txt > > - > http://stackoverflow.com/questions/9639449/cmake-how-to-pass-preprocessor-macros > > - > http://stackoverflow.com/questions/7900661/how-to-read-a-cmake-variable-in-c-source-code > > if i have some time i will have a look at them... > > ciao > a.l.e Referencing http://stackoverflow.com/questions/3780667/use-cmake-to-get-build-time-svn-revision
The above stackoverflow topic deals with calls to the cmake standard module "FindSubversion" which, in turn, takes the results of svn info and parses them into various variables. I found a project for FindSubversion.cmake at http://code.google.com/p/tombexcavator/source/browse/trunk/cmake/FindSubversion.cmake?r=81. I'm not sure "svn info" is the way to go; instead the command "svnversion" seems appropriate. So I'm playing around with adding a cmake MACRO to a modified version of FindSubversion that invokes svnversion. Using the strategy of the stackoverflow topic above, I'm working on a method using cmake which invokes "svnversion" and creates a header file, svnversion.h, that may be used by about.h (I'm assuming in c++ headers may include other headers). The header svnversion.h would create a variable SVNVERSION assigned the output from running the svnversion command. The output of a svnversion command is terse, example: themis Scribus # svnversion 17871M themis Scribus # And the additional benefit is that alphabetic characters will appear, such as the "M" above, if the Subversion tree has been modified or otherwise not complete. I'm gated now because Gentoo copies the Subversion tree over to a temporary directory, i.e. /var/tmp/portage/app-office/scribus..., leaving behind the .svn directory. In recent versions of Subversion, the top most .svn directory contains the database that manages the entire tree below. So, in a Gentoo emerge, cmake invokes "svnversion" against its staged "tmp" tree and therefore fails since it cannot find the .svn subdirectory. The part I'm focusing on now is to have Gentoo provide a reference back to its source of the Scribus Subversion tree, i.e. /usr/portage/distfiles/svn-src/scribus/Scribus, so the svnversion command is feed that path -- it should work then. This should be helpful for other Gentoo builds based on Subversion pulls, e.g. those labeled version "9999". John -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.scribus.net/pipermail/scribus/attachments/20121113/64888daf/attachment.html>