You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Graham Leggett <mi...@sharp.fm> on 2007/02/14 16:02:54 UTC

Ant v1.7 and pathnames with spaces

Hi all,

I am trying to build an ant build script capable of calling the cl.exe
compiler from Visual Studio to compile some c++ code.

When called from the command line, the parameter:

  -I"c:\Program Files\somewhere\include"

is resolved correctly.

>From within ant, the parameter:

  <arg value="-I&quot;c:\Program Files\somewhere\include&quot;" />

Doesn't work, the quotes get stripped out and cl.exe complains about the
following unknown file:

  Files\somewhere\include

Is the XML &quot; sequence the correct way of specifying quotes, or is
there some other mechanism that should be used?

I am trying to determine whether ant v1.7 is broken, or whether I am doing
something wrong.

Regards,
Graham
--



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: Ant v1.7 and pathnames with spaces

Posted by Peter Reilly <pe...@gmail.com>.
Try using a single quote.
value="-I'c:\Program Files\somewhere\include;'"

note that
a space in a param causes a double quote to be placed
around the full arg (by windows impl of Process).

Peter

On 2/14/07, Steve Loughran <st...@apache.org> wrote:
> Graham Leggett wrote:
> > Steve Loughran wrote:
> >> Graham Leggett wrote:
> >>> Hi all,
> >>>
> >>> I am trying to build an ant build script capable of calling the cl.exe
> >>> compiler from Visual Studio to compile some c++ code.
> >>>
> >>> When called from the command line, the parameter:
> >>>
> >>>   -I"c:\Program Files\somewhere\include"
> >>>
> >>> is resolved correctly.
> >>>
> >>> From within ant, the parameter:
> >>>
> >>>   <arg value="-I&quot;c:\Program Files\somewhere\include&quot;" />
> >>>
> >>> Doesn't work, the quotes get stripped out and cl.exe complains about the
> >>> following unknown file:
> >>>
> >>>   Files\somewhere\include
> >>>
> >>> Is the XML &quot; sequence the correct way of specifying quotes, or is
> >>> there some other mechanism that should be used?
> >>>
> >>> I am trying to determine whether ant v1.7 is broken, or whether I am
> >>> doing
> >>> something wrong.
> >>
> >> do a -verbose run and see what is being passed down
> >
> > That's what I did do - which is how I could see the quotes were being
> > stripped.
>
> well, print it out and let us see it.
>
> -why not use the <cc> task from ant-contrib.sf.net? if you want detailed
> cc stuff if works very well, though calling nmake is another option.
>
> -you can also embed msbuild scripts inside Ant, using a special msbuild
> antlib in our sandbox...
>
> -steve
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: Ant v1.7 and pathnames with spaces

Posted by Steve Loughran <st...@apache.org>.
Graham Leggett wrote:
> Steve Loughran wrote:
>> Graham Leggett wrote:
>>> Hi all,
>>>
>>> I am trying to build an ant build script capable of calling the cl.exe
>>> compiler from Visual Studio to compile some c++ code.
>>>
>>> When called from the command line, the parameter:
>>>
>>>   -I"c:\Program Files\somewhere\include"
>>>
>>> is resolved correctly.
>>>
>>> From within ant, the parameter:
>>>
>>>   <arg value="-I&quot;c:\Program Files\somewhere\include&quot;" />
>>>
>>> Doesn't work, the quotes get stripped out and cl.exe complains about the
>>> following unknown file:
>>>
>>>   Files\somewhere\include
>>>
>>> Is the XML &quot; sequence the correct way of specifying quotes, or is
>>> there some other mechanism that should be used?
>>>
>>> I am trying to determine whether ant v1.7 is broken, or whether I am 
>>> doing
>>> something wrong.
>>
>> do a -verbose run and see what is being passed down
> 
> That's what I did do - which is how I could see the quotes were being 
> stripped.

well, print it out and let us see it.

-why not use the <cc> task from ant-contrib.sf.net? if you want detailed 
cc stuff if works very well, though calling nmake is another option.

-you can also embed msbuild scripts inside Ant, using a special msbuild 
antlib in our sandbox...

-steve




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: Ant v1.7 and pathnames with spaces

Posted by Graham Leggett <mi...@sharp.fm>.
Steve Loughran wrote:
> Graham Leggett wrote:
>> Hi all,
>>
>> I am trying to build an ant build script capable of calling the cl.exe
>> compiler from Visual Studio to compile some c++ code.
>>
>> When called from the command line, the parameter:
>>
>>   -I"c:\Program Files\somewhere\include"
>>
>> is resolved correctly.
>>
>> From within ant, the parameter:
>>
>>   <arg value="-I&quot;c:\Program Files\somewhere\include&quot;" />
>>
>> Doesn't work, the quotes get stripped out and cl.exe complains about the
>> following unknown file:
>>
>>   Files\somewhere\include
>>
>> Is the XML &quot; sequence the correct way of specifying quotes, or is
>> there some other mechanism that should be used?
>>
>> I am trying to determine whether ant v1.7 is broken, or whether I am 
>> doing
>> something wrong.
> 
> do a -verbose run and see what is being passed down

That's what I did do - which is how I could see the quotes were being 
stripped.

Regards,
Graham
--

Re: Ant v1.7 and pathnames with spaces

Posted by Steve Loughran <st...@apache.org>.
Graham Leggett wrote:
> Hi all,
> 
> I am trying to build an ant build script capable of calling the cl.exe
> compiler from Visual Studio to compile some c++ code.
> 
> When called from the command line, the parameter:
> 
>   -I"c:\Program Files\somewhere\include"
> 
> is resolved correctly.
> 
> From within ant, the parameter:
> 
>   <arg value="-I&quot;c:\Program Files\somewhere\include&quot;" />
> 
> Doesn't work, the quotes get stripped out and cl.exe complains about the
> following unknown file:
> 
>   Files\somewhere\include
> 
> Is the XML &quot; sequence the correct way of specifying quotes, or is
> there some other mechanism that should be used?
> 
> I am trying to determine whether ant v1.7 is broken, or whether I am doing
> something wrong.

do a -verbose run and see what is being passed down

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org