Matt Sarett | 1146686 | 2016-02-19 13:41:30 -0500 | [diff] [blame] | 1 | # test.cmake.in |
| 2 | |
| 3 | # Copyright (C) 2016 Glenn Randers-Pehrson |
| 4 | # Written by Roger Leigh, 2016 |
| 5 | |
| 6 | # This code is released under the libpng license. |
| 7 | # For conditions of distribution and use, see the disclaimer |
| 8 | # and license in png.h |
| 9 | |
| 10 | set(TEST_OPTIONS "@TEST_OPTIONS@") |
| 11 | set(TEST_FILES "@TEST_FILES@") |
| 12 | |
| 13 | foreach(file ${TEST_FILES}) |
| 14 | file(TO_NATIVE_PATH "${file}" native_file) |
| 15 | list(APPEND NATIVE_TEST_FILES "${native_file}") |
| 16 | endforeach() |
| 17 | |
| 18 | # Add the directory containing libpng to the PATH (Windows only) |
| 19 | if(WIN32) |
| 20 | get_filename_component(LIBPNG_DIR "${LIBPNG}" PATH) |
| 21 | file(TO_NATIVE_PATH "${LIBPNG_DIR}" LIBPNG_DIR) |
| 22 | set(ENV{PATH} "${LIBPNG_DIR};$ENV{PATH}") |
| 23 | endif() |
| 24 | |
| 25 | execute_process(COMMAND "${CMAKE_COMMAND}" -E echo "Running ${TEST_COMMAND}" ${TEST_OPTIONS} ${NATIVE_TEST_FILES}) |
| 26 | |
| 27 | execute_process(COMMAND "${TEST_COMMAND}" ${TEST_OPTIONS} ${NATIVE_TEST_FILES} |
| 28 | RESULT_VARIABLE TEST_STATUS) |
| 29 | if(TEST_STATUS) |
| 30 | message(FATAL_ERROR "Returned failed status ${TEST_STATUS}!") |
| 31 | endif() |