Hello,
for my project I have a sub dir with test case which feeds the tests
'*.input' and allows to check to output '*.expected'. For documentation
purpose, I have a python script which generates a TestMatrix.rst file.
Using CMake I have:
dir structure:
$root/{src,include,utils,test}
test/CMakeLists.txt
project(test LANGUAGES CXX)
...
set(TEST_MATRIX_GENERATOR
${CMAKE_CURRENT_SOURCE_DIR}/../utils/gen_test_matrix.py)
set(TEST_MATRIX_GENERATOR_TARGET
${CMAKE_CURRENT_SOURCE_DIR}/test_matrix.rst)
file(GLOB_RECURSE TEST_CASE_FILES
LIST_DIRECTORIES true
"${CMAKE_CURRENT_SOURCE_DIR}/test_case/" "*.expected"
)
add_custom_command(
TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${TEST_MATRIX_GENERATOR} ${CMAKE_CURRENT_SOURCE_DIR} >
${TEST_MATRIX_GENERATOR_TARGET}
DEPENDS ${TEST_MATRIX_GENERATOR} ${TEST_CASE_FILES}
BYPRODUCT ${TEST_MATRIX_GENERATOR_TARGET}
COMMENT "Generate TestCase Matrix (RST)"
)
set_source_files_properties(
${TEST_MATRIX_GENERATOR_TARGET}
PROPERTIES GENERATED TRUE
)
but I assume, this isn't clever since it doesn't depend on the test_case
dirs/files as I've seen so far. Changes in these file doesn't trigger
the generation process, removing the ${TEST_MATRIX_GENERATOR_TARGET}
doesn't recreate it. How to get it working/generating on each changes
(additions) of the files/dirs in test_case?
Thanks,
Olaf
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake