> 'm4' outputs only on stdout and does not have an option to
> specify the
> output file. Please
> suggest me a solution for this...
I had a similar problem and also with a preprocessor. I ended up writing
a CMake script like this:
EXECUTE_PROCESS(
COMMAND my-command "${VAR_IFILE}"
RESULT_VARIABLE VAR_RESULT
OUTPUT_VARIABLE VAR_CONTENT)
# Do whatever you want with ${VAR_CONTENT}
FILE (WRITE "${VAR_OFILE}" "${VAR_CONTENT}")
UNSET(VAR_CONTENT)
and the in a CMakeLists.txt
# ADD_CUSTOM_COMMAND( ... ${CMAKE_COMMAND} -DVAR_IFILE=/path/to/source.m4.file
-DVAR_OFILE=/path/to/dest.cpp -P ${SCRIPT_ABOVE} ...)
# also SET_SOURCE_FILES_PROPERTIES and LIST(APPEND PRJ_SRCS "${VAR_OFILE}")
> Also, if I wish to do this for all CPP files, how do I
> specify it?
You could write a MACRO that will accept INPUT filename, OUTPUT filename
and a variable name for a list of sources (to completely automate
everything).
Denis
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake