1
0
mirror of https://github.com/glennrp/libpng.git synced 2025-08-06 02:15:49 +03:00
Files
libpng/scripts/cmake/test.cmake.in
Cosmin Truta 9ee82380da [libpng16] test: Tidy up the logging of test program arguments in CTest
This is a cherry-pick of commit 2e416c623d
from branch 'libpng18'.
2024-10-06 21:54:21 +03:00

36 lines
1.1 KiB
CMake

# test.cmake.in
# Copyright (c) 2024 Cosmin Truta
# Copyright (c) 2016 Glenn Randers-Pehrson
# Written by Roger Leigh, 2016
#
# Use, modification and distribution are subject to
# the same licensing terms and conditions as libpng.
# Please see the copyright notice in png.h or visit
# http://libpng.org/pub/png/src/libpng-LICENSE.txt
#
# SPDX-License-Identifier: libpng-2.0
set(TEST_OPTIONS "@TEST_OPTIONS@")
set(TEST_FILES "@TEST_FILES@")
foreach(file ${TEST_FILES})
file(TO_NATIVE_PATH "${file}" native_file)
list(APPEND NATIVE_TEST_FILES "${native_file}")
endforeach()
# Add the directory containing libpng to the PATH (Windows only)
if(WIN32)
get_filename_component(LIBPNG_DIR "${LIBPNG}" PATH)
file(TO_NATIVE_PATH "${LIBPNG_DIR}" LIBPNG_DIR)
set(ENV{PATH} "${LIBPNG_DIR};$ENV{PATH}")
endif()
string(JOIN " " TEST_COMMAND_STRING "${TEST_COMMAND}" ${TEST_OPTIONS} ${NATIVE_TEST_FILES})
message(STATUS "Running ${TEST_COMMAND_STRING}")
execute_process(COMMAND "${TEST_COMMAND}" ${TEST_OPTIONS} ${NATIVE_TEST_FILES}
RESULT_VARIABLE TEST_STATUS)
if(TEST_STATUS)
message(FATAL_ERROR "Returned failed status ${TEST_STATUS}!")
endif()