File: PNGCheckLibconf.cmake

package info (click to toggle)
libpng1.6 1.6.55-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,208 kB
  • sloc: ansic: 58,258; sh: 6,981; awk: 794; cpp: 684; makefile: 617; python: 391; asm: 22
file content (45 lines) | stat: -rw-r--r-- 1,542 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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()