[CMake] sigil ($) in add custom command

J Decker d3ck0r at gmail.com
Mon Apr 28 12:44:19 EDT 2014


foreach( file ${files} )
ADD_CUSTOM_COMMAND(
...
COMMAND cpp -P -CC -DDPI_EXTERN ${file} >>
${FILEEXTERN}.tmp \; done'
)




On Mon, Apr 28, 2014 at 9:05 AM, j s <j.s4403 at gmail.com> wrote:

> 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?
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20140428/00e94b7d/attachment.html>


More information about the CMake mailing list