Cosmin Truta 0cc6436ef5 build: Repair and reduce the CMake build dependency graph
A funny thing happened while refactoring the function argument parsing
in the `PNGGenConfig` module: the processing of dependencies inside
the CMake function `generate_copy` got fixed, thanks to an inadvertent
typo correction!

Going down the rabbit hole, we uncovered two issues:

 1. A typo in `scripts/cmake/PNGGenConfig.cmake` caused a dependency
    declaration to disappear, disrupting the graph. Fortunately, this
    disruption was being mitigated by an additional set of (redundant)
    symbolic target declarations that kept the CMake build going.

 2. The exact string matching inside `scripts/cmake/gensrc.cmake.in`
    imposed an artificial limitation, disallowing the use of absolute
    file paths.

The typo correction in (1), and the use of regex matching instead of
exact string matching in (2), allowed us to use absolute file paths
in the main CMake file, consistently, thus allowing CMake to recognize
them as uniquely-identifiable nodes in the dependency graph. There
should be no further need to have extra symbolic targets for proper
node identification.

In the end, we shaved off the redundant symbolic target declarations,
retaining only `png_genfiles` and `png_genprebuilt`.
2025-05-29 22:55:00 +03:00
..

CMake Files, Lists and Scripts for the PNG Reference Library

  • Copyright (c) 2018-2024 Cosmin Truta.
  • Copyright (c) 2007-2018 Glenn Randers-Pehrson.
  • Originally written by Christian Ehrlicher, 2007.

Use, modification and distribution of the CMake files in the libpng 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

File List

CMakeLists.txt                 ==>  The main CMake lists file
scripts/cmake/AUTHORS.md       ==>  The Authors file
scripts/cmake/README.md        ==>  This file
scripts/cmake/PNGConfig.cmake  ==>  Config file for FindPNG
scripts/cmake/genchk.cmake.in  ==>  Template for genchk.cmake
scripts/cmake/genout.cmake.in  ==>  Template for genout.cmake
scripts/cmake/gensrc.cmake.in  ==>  Template for gensrc.cmake
scripts/cmake/test.cmake.in    ==>  Template for test.cmake

Acknowledgements

See the accompanying file scripts/cmake/AUTHORS.md for the list of Contributing Authors.

If you are a Contributing Author, please make sure that you are being acknowledged.