GoogleTest/gtest_add_tests: xUnit report generation
I could not figure out a way to generate xUnit reports while using upstream GoogleTest.cmake.
To make the test executable generate the report you need to pass --gtest_output=xml:outputFilename.xml
. The problem is that gtest_add_tests
generates a target for every single test and you can only pass the very same argument to it, the result is that outputFilename.xml gets overwritten over and over again. I tried to specify EXTRA_ARGS --gtest_output=xml:xunit-$<TARGET_PROPERTY:OUTPUT_NAME>.xml
but that yields an error:
$<TARGET_PROPERTY:prop> may only be used with binary targets. It may not
be used with add_custom_command or add_custom_target. Specify the target
to read a property from using the $<TARGET_PROPERTY:tgt,prop> signature
instead.
For now I've forked GoogleTest.cmake and added --gtest_output=xml:xunit-${gtest_test_name}.xml
to the command ARGS for the test targets. It would be nice if this was possible with upstream GoogleTest.cmake in one way or another.
Edited by Dominik Schmidt