Skip to content
Snippets Groups Projects
Commit 033f0dd2 authored by Russell Taylor's avatar Russell Taylor
Browse files

Make sure Testing directory is there for XUnit output. Stop VS regenerating...

Make sure Testing directory is there for XUnit output. Stop VS regenerating test files every time. Re #2525.
parent fd8adccf
No related branches found
No related tags found
No related merge requests found
...@@ -90,6 +90,7 @@ if ( CXXTEST_FOUND ) ...@@ -90,6 +90,7 @@ if ( CXXTEST_FOUND )
include_directories ( ${CXXTEST_INCLUDE_DIR} ) include_directories ( ${CXXTEST_INCLUDE_DIR} )
enable_testing () enable_testing ()
add_custom_target( check COMMAND ${CMAKE_CTEST_COMMAND} ) add_custom_target( check COMMAND ${CMAKE_CTEST_COMMAND} )
make_directory( ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Testing )
message ( STATUS "Added target ('check') for unit tests" ) message ( STATUS "Added target ('check') for unit tests" )
else () else ()
message ( STATUS "Could NOT find CxxTest - unit testing not available" ) message ( STATUS "Could NOT find CxxTest - unit testing not available" )
......
...@@ -94,19 +94,13 @@ ...@@ -94,19 +94,13 @@
# CXXTEST_ADD_TEST (public macro) # CXXTEST_ADD_TEST (public macro)
#============================================================= #=============================================================
macro(CXXTEST_ADD_TEST _cxxtest_testname) macro(CXXTEST_ADD_TEST _cxxtest_testname)
# the directory to write test results
set ( _cxxtest_xml_outdir ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/Testing )
add_custom_command ( OUTPUT ${_cxxtest_xml_outdir}
COMMAND ${CMAKE_COMMAND} ARGS -E make_directory ${_cxxtest_xml_outdir})
# determine the cpp filename # determine the cpp filename
set(_cxxtest_real_outfname ${CMAKE_CURRENT_BINARY_DIR}/${_cxxtest_testname}_runner.cpp) set(_cxxtest_real_outfname ${CMAKE_CURRENT_BINARY_DIR}/${_cxxtest_testname}_runner.cpp)
add_custom_command( add_custom_command(
OUTPUT ${_cxxtest_real_outfname} OUTPUT ${_cxxtest_real_outfname}
DEPENDS ${PATH_FILES} ${_cxxtest_xml_outdir} DEPENDS ${PATH_FILES}
COMMAND python ${CXXTEST_TESTGEN_EXECUTABLE} --root COMMAND python ${CXXTEST_TESTGEN_EXECUTABLE} --root
--xunit-printer --world ${_cxxtest_testname} --xunit-printer --world ${_cxxtest_testname} -o ${_cxxtest_real_outfname}
--xunit-file ${_cxxtest_xml_outdir}/TEST-${_cxxtest_testname}.xml
-o ${_cxxtest_real_outfname}
) )
set_source_files_properties(${_cxxtest_real_outfname} PROPERTIES GENERATED true) set_source_files_properties(${_cxxtest_real_outfname} PROPERTIES GENERATED true)
...@@ -120,12 +114,9 @@ macro(CXXTEST_ADD_TEST _cxxtest_testname) ...@@ -120,12 +114,9 @@ macro(CXXTEST_ADD_TEST _cxxtest_testname)
add_custom_command( add_custom_command(
OUTPUT ${_cxxtest_cpp} OUTPUT ${_cxxtest_cpp}
DEPENDS ${_cxxtest_h} ${_cxxtest_xml_outdir} DEPENDS ${_cxxtest_h}
COMMAND python ${CXXTEST_TESTGEN_EXECUTABLE} --part COMMAND python ${CXXTEST_TESTGEN_EXECUTABLE} --part
--world ${_cxxtest_testname} -o ${_cxxtest_cpp} --world ${_cxxtest_testname} -o ${_cxxtest_cpp} ${_cxxtest_h}
--xunit-printer
--xunit-file ${_cxxtest_xml_outdir}/TEST-${_cxxtest_testname}.xml
${_cxxtest_h}
) )
set_source_files_properties(${_cxxtest_cpp} PROPERTIES GENERATED true) set_source_files_properties(${_cxxtest_cpp} PROPERTIES GENERATED true)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment