You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Ben Pracht <bp...@nc.rr.com> on 2006/02/17 22:32:18 UTC
Trying to escape quote character in define argument for cpptasks
I'm trying to pass in a macro define to the command line to define the
level of code being used. Something like
gcc -o objname.o source.c -DFIXLVL=\"FEB 17 2006\"
the code does something like:
static const char mszFixLvl[] = " " __FILE__ " at " FIXLVL " on "
__DATE__ " at " __TIME__ " ";
so the value of FIXLVL must have quotes at the time preprocessing begins
and cannot have been stripped off by ant, cpptasks, or any other thing
in between.
I'm using cpptasks 1.0b3, ant 1.6.5.
I've tried
<defineset><define name="FIXLVL" value=""FEB 17
2006""/></defineset>
and
<compilerarg value="-D"/><compilerarg value="FIXLVL="FEB 17
2006""/>
I've even tried defining the fix level in a property, and then using the
property name in the defineset value, but it was too smart for that.
How can I force this thing to listen to me?
Thanks,
Ben
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Trying to escape quote character in define argument for cpptasks
Posted by Dominique Devienne <dd...@gmail.com>.
> <compilerarg value="-D"/><compilerarg value="FIXLVL="FEB 17
> 2006""/>
Shouldn't this be:
<compilerarg value="-DFIXLVL="FEB 17 2006""/>
??
> I've even tried defining the fix level in a property, and then using the
> property name in the defineset value, but it was too smart for that.
>
> How can I force this thing to listen to me?
If this doesn't work, doesn't the pre-processor support a "stringify"
command, something like #NAME, that would be the quote around it
automatically?
If not, then use a header that contains a default value, and
<replaceregex> it to whatever you want before the build, and <cc> will
do its dependency magic to recompile only the necessary files. --DD
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org