2010/7/28 Óscar Fuentes <o...@wanadoo.es>:
> Eric Noulard <eric.noul...@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
file(WRITE ${THE_FILE} "#include whatever\n")
file(APPEND ${THE_FILE} "${YOURSTRING}\n")
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to