This question already has an answer here:
- error: stray '\' in program in macro definition 1 answer
The following python code
env.Command(versionFile, allSrcs + [".git/index", "SConstruct"],
'echo "#define ZSIM_BUILDDATE \\""`date`\\""\\\\n#define ZSIM_BUILDVERSION \\""`python misc/gitver.py`\\""" >>' + versionFile)
produces an output like this
$ cat build/opt/version.h
#define ZSIM_BUILDDATE "Sat Apr 19 13:31:41 CET 2014"\n#define ZSIM_BUILDVERSION "master:10:a8c417b:2fc 3+ 2- d5cec7e7"
As you can see it doesn't understand that '\n'
means new line+carriage return
. Instead it just print '\'
and 'n'
.
How can I fix that?
P.S: This question is a follow-up for this one. the previous post was general and didn't pinpoint to the problem. Also I use scons for build. any help would be appreciated. thank you