[CMake] sigil ($) in add custom command

j s j.s4403 at gmail.com
Mon Apr 28 12:05:28 EDT 2014


Through trial and error, I've found that I can do the following to
escape a variable in a custom command.

ADD_CUSTOM_COMMAND(
...
COMMAND bash -c 'for i in ${FILES}\; do cpp -P -CC -DDPI_EXTERN $$i >>
${FILEEXTERN}.tmp \; done'

...
)


Is this the proper way to escape a variable that needs to make to the
shell command level?  I'm assuming this would only work through a Unix
Makefile?  Is there an alternative to iterating over a variable in a
custom command?


More information about the CMake mailing list