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

Michael Wild themiwi at gmail.com
Thu Jul 29 17:16:45 EDT 2010


On 29. Jul, 2010, at 19:55 , Óscar Fuentes wrote:

> Óscar Fuentes <ofv at wanadoo.es> writes:
> 
>> Andreas Pakulat <apaku at gmx.de> writes:
>> 
>> [snip]
>> 
>>> add_custom_command( OUTPUT build.h
>>>                    COMMAND cmake -E echo \"\#define FOO \\"bar\\"\" >build.h )
>> 
>> Well, it even makes sense, although it is not immediately
>> obvious. Thanks!
> 
> I spoke too soo. This command:
> 
> add_custom_command(OUTPUT buildobj.h
>  COMMAND ${CMAKE_COMMAND} -E echo \"\#define BUILDOBJ \\"foo bar\\"\"
>> buildobj.h
>  )
> 
> works fine on Windows. But on Linux it the file contents are this:
> 
> #define BUILDOBJ "foo\ bar"
> 
> This is quoting hell. Back to configure_file.

What's wrong with my solution? Doesn't even require a custom command...

Michael



More information about the CMake mailing list