[libpng] Forgot to check in new file PNGCheckLibconf.cmake.
Some checks are pending
Codecov / run (push) Waiting to run
CodeQL / Analyze (cpp) (push) Waiting to run

This commit is contained in:
David Korth 2025-05-03 20:18:22 -04:00
parent 66e75f5a40
commit b4ba027439

View File

@ -0,0 +1,45 @@
# PNGConfig.cmake
# Utility functions for configuring and building libpng
# Copyright (c) 2025 Cosmin Truta
#
# 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
# Check libconf file (pnglibconf.h.* or *.dfa):
# png_check_libconf([HEADER <file>] [DFA_XTRA <file>])
function(png_check_libconf)
set(options)
set(oneValueArgs HEADER DFA_XTRA)
set(multiValueArgs)
cmake_parse_arguments(_CHK "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if(_CHK_HEADER AND _CHK_DFA_XTRA)
message(FATAL_ERROR "png_check_libconf: Mutually-exclusive arguments: HEADER and DFA_XTRA")
endif()
if(_CHK_HEADER)
if(EXISTS "${_CHK_HEADER}")
if("x${_CHK_HEADER}" STREQUAL "x${PNG_LIBCONF_HEADER_PREBUILT}")
message(STATUS "Using standard libconf header: ${_CHK_HEADER}")
else()
message(STATUS "Using custom libconf header: ${_CHK_HEADER}")
endif()
else()
message(SEND_ERROR "Could not find libconf header: ${_CHK_HEADER}")
endif()
else()
if("x${_CHK_DFA_XTRA}" STREQUAL "x")
message(STATUS "Creating standard configuration")
elseif(EXISTS "${_CHK_DFA_XTRA}")
message(STATUS "Creating custom configuration with DFA_XTRA file: ${_CHK_DFA_XTRA}")
else()
message(SEND_ERROR "Could not find DFA_XTRA file: ${_CHK_DFA_XTRA}")
endif()
endif()
endfunction()