[CMake] Redirect stdout from COMMAND in ADD_CUSTOM_COMMAND (CMake 2.6 RC8)
Eric Noulard
eric.noulard at gmail.com
Mon Apr 21 07:12:36 EDT 2008
2008/4/21, Alejandro Morell García <alejandro.morell at gmail.com>:
>
> I'm trying to convert the following script into CMake add_custom_command:
>
> echo #include "glib-object.h" > gstmarshal.c.tmp
> echo #include "gstmarshal.h" >> gstmarshal.c.tmp
> glib-genmarshal --body --prefix=gst_marshal ..\..\gst\gstmarshal.list
> >> gstmarshal.c.tmp
> move gstmarshal.c.tmp ..\..\gst\gstmarshal.c
> echo #include "gst/gstconfig.h" > gstmarshal.h.tmp
> glib-genmarshal --header --prefix=gst_marshal ..\..\gst\gstmarshal.list
> >> gstmarshal.h.tmp
> move gstmarshal.h.tmp ..\..\gst\gstmarshal.h
>
> That I translated in a more simple "cmake script":
>
> FILE(WRITE
> ${CMAKE_BINARY_DIR}/gst/gstmarshal.c.template
> "#include \"glib-object.h\"" "\n" "#include \"gstmarshal.h\"" "\n")
>
> ADD_CUSTOM_COMMAND(OUTPUT gstmarshal.c
> COMMAND ${CMAKE_COMMAND} -E copy gstmarshal.c.template gstmarshal.c
> COMMAND glib-genmarshal --body --prefix=gst_marshal
> ${CMAKE_CURRENT_SOURCE_DIR}/gstmarshal.list >> gstmarshal.c
> WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/gst/
> COMMENT "Generating flex and bison parsers" VERBATIM
> )
>
> If I create a linux makefile, the make fails with:
>
> (process:11394): GLib-Genmarshal-WARNING **: failed to open ">>": No such
> file or directory
>
> and all stdout from glib-genmarshal is echoed in terminal.
>
> Inspecting Makefile, the problem seems this (file
> gst/CMakeFiles/libgstreamer.dir/build.make):
>
> cd
> /home/alejandro/Proyectos/gstreamer/gstreamer-0.10.19/build/gst/
> && glib-genmarshal --body --prefix=gst_marshal
> /home/alejandro/Proyectos/gstreamer/gstreamer-0.10.19/gst/gstmarshal.list
> ">>" gstmarshal.c
>
> Cmake coutes >> operator, so no redirecting is done.
>
> Someone knows how to avoid this?
Did you try to remove VERBATIM option for ADD_CUSTOM_COMMAND?
I have a similar ADD_CUSTOM_COMMAND which use
>> or > redirection with no pronlem.
I know that VERBATIM _should_ be used but if it works without it
it may be worth a bug report.
However which version of CMake do you use?
--
Erk
More information about the CMake
mailing list