1# test.cmake.in 2 3# Copyright (c) 2024 Cosmin Truta 4# Copyright (c) 2016 Glenn Randers-Pehrson 5# Written by Roger Leigh, 2016 6# 7# Use, modification and distribution are subject to 8# the same licensing terms and conditions as libpng. 9# Please see the copyright notice in png.h or visit 10# http://libpng.org/pub/png/src/libpng-LICENSE.txt 11# 12# SPDX-License-Identifier: libpng-2.0 13 14set(TEST_OPTIONS "@TEST_OPTIONS@") 15set(TEST_FILES "@TEST_FILES@") 16 17foreach(file ${TEST_FILES}) 18 file(TO_NATIVE_PATH "${file}" native_file) 19 list(APPEND NATIVE_TEST_FILES "${native_file}") 20endforeach() 21 22# Add the directory containing libpng to the PATH (Windows only) 23if(WIN32) 24 get_filename_component(LIBPNG_DIR "${LIBPNG}" PATH) 25 file(TO_NATIVE_PATH "${LIBPNG_DIR}" LIBPNG_DIR) 26 set(ENV{PATH} "${LIBPNG_DIR};$ENV{PATH}") 27endif() 28 29message("Running ${TEST_COMMAND}" ${TEST_OPTIONS} ${NATIVE_TEST_FILES}) 30execute_process(COMMAND "${TEST_COMMAND}" ${TEST_OPTIONS} ${NATIVE_TEST_FILES} 31 RESULT_VARIABLE TEST_STATUS) 32if(TEST_STATUS) 33 message(FATAL_ERROR "Returned failed status ${TEST_STATUS}!") 34endif() 35