[CMake] Redirect stdout from COMMAND in ADD_CUSTOM_COMMAND (CMake 2.6 RC8)
Alejandro Morell García
alejandro.morell at gmail.com
Sun Apr 20 19:22:16 EDT 2008
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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080421/1b1dd8b5/attachment.htm>
More information about the CMake
mailing list