[CMake] Wrong escaping of custom-command arguments?

Andreas Pakulat apaku at gmx.de
Thu Dec 23 17:01:15 EST 2010


Hi,

it seems that cmake doesn't properly escape the commandlines for custom
commands. I'm adding a list of strings which include whitespace and also
parenthesis "()" as arguments to a custom command. Additionally this
custom command is running a target built by the same project.

Unfortunately CMake only escapes the whitespace, but doesn't escape the
parenthesis. Hence invoking the command aborts with a
/bin/sh: Syntax error: Bad function name

Trying to solve this by quoting the individual arguments using \"
doesn't help as cmake still adds a \ before any whitespace. This leads
to wrong arguments being given to the actual command and hence it
doesn't behave as it should.

So anybody got another idea how to get these arguments through properly?

BTW: Using VERBATIM doesn't help either (I didn't expect it anyway, but
was worth a try).

Andreas

-- 
You will experience a strong urge to do good; but it will pass.


More information about the CMake mailing list