Boost logo

Boost-Build :

Subject: [Boost-build] Capture external program output using a Boost.Jam variable
From: Daniel Lidström (daniel.lidstrom_at_[hidden])
Date: 2008-12-01 07:49:20


Hello,

here's what I'm trying to do:

gcc /DGR_BUILD_TIME=1228135248 ...

GR_BUILD_TIME is the output of date +%s. I read the manual and tried this:

local GR_BUILD_TIME = [ SHELL "date +%s" ] ;

# project settings ###################################################
project
    : requirements
      <include>.

      # GCC settings

      <define>GR_BUILD_TIME=$(GR_BUILD_TIME)
.
.
.

Now, GR_BUILD_TIME is passed to gcc but it contains a trailing newline,
which causes
the compile to fail like this:

georog-dev:/home/daniel/projects/trunk/GeoROG> bjam toolset=gcc-4.1.1 -q
...patience...
...patience...
...found 4676 targets...
...updating 4 targets...
gcc.compile.c++ bin/gcc-4.1.1/debug/GCore.o
g++: no input files
/bin/sh: -Ibin/gcc-4.1.1/debug: not found

    "g++" -ftemplate-depth-128 -O0 -fno-inline -Wall -g -fPIC -Winvalid-pch
-DBOOST_BUILD_PCH_ENABLED -DGR_BUILD_TIME=1228135248
 -I"bin/gcc-4.1.1/debug" -I"." -I"../GFL" -I"../SBGFLTK/include"
-I"/home/daniel/projects/Vendor/Boost/include/boost-1_37"
-I"/usr/include/glib-2.0" -I"/usr/lib/glib-2.0/include" -c -o
"bin/gcc-4.1.1/debug/GCore.o"
"/home/daniel/projects/trunk/GeoROG/GCore/GCore.cpp"

...failed gcc.compile.c++ bin/gcc-4.1.1/debug/GCore.o...
...failed updating 1 target...

There's a newline right after -DGR_BUILD_TIME=1228135248, which is why the
line after is being treated as a command.

How can I accomplish this? I'm using Milestone12 with Boost.Jam Version
3.1.13. OS=LINUX.

Thanks in advance!

-- 
Daniel Lidströ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