[CMake] How to Redirect Output and Ignore Command Failures

Mike Howells mike.howells at smartsgroup.com
Sun Aug 30 22:52:53 EDT 2009


I'm creating a custom target to get XML output from my Boost.test test
cases for use in Hudson, and I want the output for all tests to be
generated even if some fail. 

Unfortunately there are two blockers:
1.	cmake makes the first test case to fail stop the build.
2.	cmake offers no way to redirect output and using ">" doesn't
seem to work.

Is there a way to tell cmake to:
1.	Redirect output from a custom command?
2.	Ignore the return status from a custom command? 

Here's my CMakeLists.txt fragment, where exeFiles holds the list of test
case executables:

foreach(exeName ${exeFiles})
  list(APPEND xmlList ${exeName}.xml)
  add_custom_command(OUTPUT ${exeName}.xml
    COMMAND ${exeName} --output_format=XML --log_level=all
--report_level=no
      >${exeName}.xml VERBATIM)
endforeach()

add_custom_target(xmltest DEPENDS ${xmlList})


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090830/b56d7e5b/attachment.htm>


More information about the CMake mailing list