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

Óscar Fuentes ofv at wanadoo.es
Thu Jul 29 13:55:46 EDT 2010


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



More information about the CMake mailing list