test.cmake.in 991 B

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