2007/4/13, Mathieu Malaterre <[EMAIL PROTECTED]>:
'lo

  I am convinced this is an easy one,
but I could not figure out how
to redirect standard output (from a process) into a file. Basically I
would need to run EXECUTE_PROCESS from within an ADD_CUSTOM_COMMAND
(run the process and capture output only when all the dependencies are
met).

If I understand your problem well you
may

1) write the EXECUTE_PROCESS relted command
   into a cmake script file using

FILE(WRITE /tmp/executeMe.cmake
     "EXECUTE_PROCESS(COMMAND ls
                                        OUTPUT_FILE lsout.txt)"

(look at FILE(xxx command for generating more complex script file)

2) then in your ADD_CUSTOM_COMMAND  you call

${CMAKE_CMAKE_COMMAND} -P /tmp/executeMe.cmake

That is CMake "script processing mode".

I did something similar FILE(WRITE a CMake script and then
execute the script with CMake -P there:
http://cvs.savannah.nongnu.org/viewcvs/tsp/make/UsePackageBackup.cmake?root=tsp&view=markup

This script is used to build a "dated" tarball using CPack.
You'll see that the annoying thing when FILE(WRITE a CMake script is
to understand when you need  extra "\" .

3) After (and outside) the ADD_CUSTOM_COMMAND you may "parse" output using

FILE(READ  lsout.txt OUTPUT_CONTENT)
STRING(REGEX MATCH ${OUTPUT_CONTENT})


--
Erk
_______________________________________________
CMake mailing list
[EMAIL PROTECTED]
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to