Boost logo

Boost-Build :

Subject: [Boost-build] How to always execute shell script before building a target
From: Steve Lorimer (steve.lorimer_at_[hidden])
Date: 2014-07-01 00:57:38


My aim is to build a library which includes version information.

I have a script which will update ./version.cpp only if the version has
changed. This to prevent unnecessary rebuilds.

I have a lib target which globs *.cpp, which is inclusive of version.cpp.

The problem is that if I run bjam I can see it execute the script, and
update version.cpp, but the library is not rebuilt.
Only when I run bjam again does it see that version.cpp has changed, and
rebuild the lib

This is my jam file:

    Echo [ SHELL "./write_version.sh" ] ;

    lib foo
        : [ glob *.cc ]
        ;

This is the output of running bjam:

$ bjam
Updating version.cpp

...found 119 targets...

$ bjam
...found 121 targets...
...updating 3 targets...
gcc.compile.c++ ../foo/bin/gcc-4.8/debug/link-static/version.o
gcc.archive ../foo/bin/gcc-4.8/debug/link-static/libfoo.a
...updated 3 targets...

How can I get both the script and the library build working together?

TIA
Steve



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