diff options
| author | ljfa-ag <ljfa-ag@web.de> | 2015-09-15 21:02:03 +0200 |
|---|---|---|
| committer | ljfa-ag <ljfa-ag@web.de> | 2015-09-15 21:02:03 +0200 |
| commit | 84cf824153d7a6bc8e7240b3683cf6f6e83be65e (patch) | |
| tree | e00eaca96136e1973f8e10883b349d458f0236f3 | |
| parent | c782034564ed422de61235917917963c5e5c3fca (diff) | |
| download | Project-Tick-84cf824153d7a6bc8e7240b3683cf6f6e83be65e.tar.gz Project-Tick-84cf824153d7a6bc8e7240b3683cf6f6e83be65e.zip | |
Make sure testfiles are copied for all tests that need them
| -rw-r--r-- | test/CMakeLists.txt | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index c640ef054e..bd4ac0295d 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -2,6 +2,13 @@ enable_testing() include_directories(${libnbt++_SOURCE_DIR}/include) include_directories(${CXXTEST_INCLUDE_DIR}) +#Specifies that the directory containing the testfiles get copied when the target is built +function(use_testfiles target) + add_custom_command(TARGET ${target} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E + copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/testfiles ${CMAKE_CURRENT_BINARY_DIR}) +endfunction() + CXXTEST_ADD_TEST(nbttest nbttest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nbttest.h) target_link_libraries(nbttest nbt++) @@ -10,15 +17,15 @@ target_link_libraries(endian_str_test nbt++) CXXTEST_ADD_TEST(read_test read_test.cpp ${CMAKE_CURRENT_SOURCE_DIR}/read_test.h) target_link_libraries(read_test nbt++) -add_custom_command(TARGET read_test POST_BUILD - COMMAND ${CMAKE_COMMAND} -E - copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/testfiles ${CMAKE_CURRENT_BINARY_DIR}) +use_testfiles(read_test) CXXTEST_ADD_TEST(write_test write_test.cpp ${CMAKE_CURRENT_SOURCE_DIR}/write_test.h) target_link_libraries(write_test nbt++) +use_testfiles(write_test) CXXTEST_ADD_TEST(zlibstream_test zlibstream_test.cpp ${CMAKE_CURRENT_SOURCE_DIR}/zlibstream_test.h) target_link_libraries(zlibstream_test nbt++ z) +use_testfiles(zlibstream_test) add_executable(format_test format_test.cpp) target_link_libraries(format_test nbt++) |
