[CMake] Why are blank-delimited strings in commands escaped on Linux?

Andreas Pakulat apaku at gmx.de
Fri Oct 2 00:26:02 EDT 2009


On 01.10.09 18:18:24, Alan W. Irwin wrote:
> This solution obviously reduces the urgency of the concern I expressed about
> the motivation for escaping blanks for Linux because workarounds like above
> can always be used.  However, I am still curious about what the motivation
> is for escaping blanks for Linux commands.

Because you have to escape spaces in arguments passed to a command. Your
misinterpreting "-Lx -ly" as a space-delimited list. Its not, in CMake a
list is (AFAIK) always delimited via ;. So CMake just see's that you pass a
_single_ argument consisting of the string >-Lx -ly< and properly quotes
that string.

>  If that turns out to be a weak
> motivation (i.e., replacing escaped blanks with ordinary delimiting blanks
> causes little harm and helps a lot for most situations) perhaps it is time
> to change CMake policy on this so that workarounds like above to avoid
> escaped blanks on Linux will not be needed in the future.

Its not a workaround, if you want to pass a list of arguments to an
external command you have to create a CMake list. A string containing a
list of arguments won't work unless the arguments are delimited by ; which
implicitly makes the string a list.

Oh and btw, spaces, umlauts and other non-ascii characters never cause any
trouble on linux (much less than on windows in fact) if you properly quote
them - which is quite easy on linux.

Andreas

-- 
You're not my type.  For that matter, you're not even my species!!!


More information about the CMake mailing list