Boost logo

Boost-Build :

Subject: [Boost-build] Write output of command to file in directory with Jamfile
From: SZALAY Mate (matbbml_at_[hidden])
Date: 2011-09-25 08:30:52


Hi,

The problem I'm trying to solve is to write the output of the
"svnversion" command to a file.
I want ot update the fine only if the content would change.

I started along these lines:
http://lists.boost.org/boost-build/2010/04/23425.php

What I've come up with is this:

---------------------------------

cur_ver = [ SHELL "echo '#define SVN_VERSION \"'`svnversion ..`'\"'" ] ;
old_ver = [ SHELL "cat svn_version.h" ] ;
if $(cur_ver) != $(old_ver)
{
  import notfile ;
  notfile write_svn_version : @write_svn_version_action ;
  actions write_svn_version_action
  {
    echo '#define SVN_VERSION "'`svnversion ..`'"' >svn_version.h
  }
}
else
{
  alias write_svn_version ;
}

---------------------------------

This works as long as I'm running it from the directory containing the
Jamfile (like: $ bjam).
The problem is that I want to depend on this target from several other
projects. I want to do things like:

exe myexe :
  main.cpp
  ../common//build_info
  [other deps]
;

If I try to do this, build_info does the svnversion on the directory
where I run bjam from.
I want it to do build the build_info target from the directory where the
target is ("common" in this case).

Is there a way to specify it?
Another solution would be if I could get the full path of the directory
containing the Jamfile with the build_info target.

Thanks,

-- 
M

Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk