[CMake] Does the echo command use the system shell?
Eric Noulard
eric.noulard at gmail.com
Wed Jul 28 14:45:47 EDT 2010
2010/7/28 Óscar Fuentes <ofv at wanadoo.es>:
> Eric Noulard <eric.noulard at gmail.com>
> writes:
>
> [snip]
>
>> if you need build
>> time creation of the file then you may write a CMake script
>> "generateMyFile.cmake" which contains such commands and use
>>
>> add_custom_command( ...
>> COMMAND ${CMAKE_COMMAND} -P generateMyFile.cmake
>> ...)
>
> That approach justs shifts the problem to a separate cmake script, but
> it still remains.
I think you are wrong.
May be you can try the attach script.
try:
cmake -DYOURSTRING="I like # \ it" -DTHE_FILE=toto.txt -P writeany.cmake
You shouldn't have "quite" problem with the previous approach.
> The task here is to write a literal string containing a "special"
> character (#) to a file, at build time. For "cmake -E echo" it requires
> platform-dependent escape sequences. My idea about the cmake -E commands
> was that they purpose is to abstract platform differences, but seems
> that that is not entirely correct, as they inherit some traits from the
> underlying platform. Or is it a bug?
I would say a feature :-)
You do not want to have to "escape" some sequences but you expect
redirection to work...
So ">" should have the appropriate meaning ?
What about "2>" ?
More seriously
I think it's complicated to avoid system specific issues with a
command like "echo".
I think that if you tell me what you would expect I may probably gives
you an example
of mine were YOUR bug is a feature for ME.
That said, that's my own opinion, I may be wrong.
--
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: writeany.cmake
Type: text/x-cmake
Size: 89 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100728/14f11a7d/attachment-0001.bin>
More information about the CMake
mailing list