correct build of test targets

correct upload of report.xml
This commit is contained in:
lukas 2020-05-20 19:37:39 +02:00
parent 998f3ea5e8
commit 8199fc2c1e

View File

@ -342,19 +342,15 @@ if (TESTS)
# link the Google test infrastructure, mocking library, and a default main fuction to # link the Google test infrastructure, mocking library, and a default main fuction to
target_link_libraries(${TESTNAME} gtest gtest_main -lpthread -lm dynuiprefresher api ${CURL_LIBRARIES} ${LIBCONFIG++_LIBRARIES}) target_link_libraries(${TESTNAME} gtest gtest_main -lpthread -lm dynuiprefresher api ${CURL_LIBRARIES} ${LIBCONFIG++_LIBRARIES})
# see https://cmake.org/cmake/help/v3.10/module/GoogleTest.html for more options to pass to it # see https://cmake.org/cmake/help/v3.10/module/GoogleTest.html for more options to pass to it
gtest_discover_tests(${TESTNAME} gtest_discover_tests(${TESTNAME})
TEST_PREFIX new:
EXTRA_ARGS --gtest_output=xml
XML_OUTPUT_DIR diri
)
add_custom_command(TARGET build-test add_custom_command(TARGET build-test
POST_BUILD POST_BUILD
COMMAND "bin/${item}" --gtest_output=xml:${item}-test-report.xml) COMMAND "${CMAKE_COMMAND}" --build "${CMAKE_BINARY_DIR}" --target ${TESTNAME}
COMMAND "bin/${TESTNAME}" --gtest_output=xml:${TESTNAME}-report.xml)
endmacro() endmacro()
add_custom_target(build-test add_custom_target(build-test
"${CMAKE_COMMAND}" --build "${CMAKE_BINARY_DIR}" --target ${testTargets}
DEPENDS ${PROJECT_NAME} DEPENDS ${PROJECT_NAME}
COMMENT "Testing ${PROJECT_NAME}") COMMENT "Testing ${PROJECT_NAME}")