[CMake] Does the echo command use the system shell?

Óscar Fuentes ofv at wanadoo.es
Wed Jul 28 13:48:24 EDT 2010

Eric Noulard <eric.noulard at gmail.com>


> 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.

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?


More information about the CMake mailing list