[CMake] CMake: how to use 'for cyclic sentence' in command add_custom_command(...)

Konstantin Tokarev annulen at yandex.ru
Tue Apr 19 10:25:14 EDT 2016



19.04.2016, 16:21, "Chaos Zhang" <zcsd2012 at gmail.com>:
> Hi,
>
> I was using 'for cyclic sentence' in command add_custom_command(...), the
> content of the CMakeLists.txt as below:
> add_custom_command(TARGET temp_target
>                                 POST_BUILD
>                                 COMMAND for x in a b c\;
>                                 do echo $x \;
>                                 done\;)
>
> The result of execution was not like as below:
> a
> b
> c
> But like this:
>
> Just print 3 blank lines. So how to use it correctly?

I'd recommended you to move your command into script file and call it instead. It will be easier to maintain because you won't need to think of escaping issues, and about keeping it as a one-liner

>
> Thanks for your help,
> Chao Zhang
>
> --
> View this message in context: http://cmake.3232098.n2.nabble.com/CMake-how-to-use-for-cyclic-sentence-in-command-add-custom-command-tp7593286.html
> Sent from the CMake mailing list archive at Nabble.com.
> --
>
> 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://public.kitware.com/mailman/listinfo/cmake

-- 
Regards,
Konstantin


More information about the CMake mailing list