[cmake-developers] wlink command-line parsing

Jiri Malak malak.jiri at gmail.com
Wed Mar 26 15:23:41 EDT 2014


> On 03/26/2014 02:45 PM, Jiri Malak wrote:
>> For unix like system cmdl is reconstruct from argv by aproximation one
>> space as separator between each item. Next is processed as characters stream.
>
> Thanks, that is the explanation I needed.  Is that done on Windows too?
No there is get cmdl directly from OS.

>
> Here is an experiment in bash with spaces in the object file names:
>
> $ for arg in file {'s 1.obj' 's 2.obj' 's 3.obj'} ; do echo "[$arg]"; done
> [file]
> [{s 1.obj]
> [s 2.obj]
> [s 3.obj}]
>
> The wlink-reconstructed string will then be
>
>  file {s 1.obj s 2.obj s 3.obj}
>
> The shell consumed the single quotes so wlink will not see them.
> This is what I meant in my "'/path with space/to/src.o'" example.
> The two-layer quoting is needed to ensure wlink sees the single
> quotes:
It is my mistake, I forgot that single qoutes are also consumed by shell.

>
> $ for arg in file {"'s 1.obj'" "'s 2.obj'" "'s 3.obj'"} ; do echo "[$arg]"; done
> [file]
> [{'s 1.obj']
> ['s 2.obj']
> ['s 3.obj'}]
>
> The wlink-reconstructed string will then be
>
>  file {'s 1.obj' 's 2.obj' 's 3.obj'}
>
> and wlink will see the single quotes.
>
> Therefore the proposed useSingleQuote API changes in CMake are not
> correct.  Instead the object names themselves should each be
> single-quoted before being sent through the normal double-quoting
> for link command-line generation.
>
> Does an invocation of wlink on Windows handle
>
>  file {"'s 1.obj'" "'s 2.obj'" "'s 3.obj'"}
>
> correctly when launched from a command prompt?
no, it works only with single quote

Jiri




More information about the cmake-developers mailing list