FindPNG: Update documentation

This commit is contained in:
Peter Kokot 2025-03-22 12:20:52 +01:00
parent 1c07011300
commit 7047f271fa
No known key found for this signature in database
GPG Key ID: A94800907AA79B36

View File

@ -5,47 +5,62 @@
FindPNG FindPNG
------- -------
Find libpng, the official reference library for the PNG image format. Finds libpng, the official reference library for the PNG image format.
.. note::
The PNG library depends on the ZLib compression library, which must be found
for this module to succeed.
Imported Targets Imported Targets
^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
.. versionadded:: 3.5 .. versionadded:: 3.5
This module defines the following :prop_tgt:`IMPORTED` target: This module defines the following :ref:`Imported Targets`:
``PNG::PNG`` ``PNG::PNG``
The libpng library, if found. The libpng library, if found.
Result variables Result Variables
^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
This module will set the following variables in your project: This module sets the following variables:
``PNG_INCLUDE_DIRS`` ``PNG_INCLUDE_DIRS``
where to find png.h, etc. Directory containing the PNG headers (e.g., ``png.h``).
``PNG_LIBRARIES`` ``PNG_LIBRARIES``
the libraries to link against to use PNG. PNG libraries required for linking.
``PNG_DEFINITIONS`` ``PNG_DEFINITIONS``
You should add_definitions(${PNG_DEFINITIONS}) before compiling code Compile definitions for using PNG, if any. They can be added with
that includes png library files. :command:`target_compile_definitions` command when not using the ``PNG::PNG``
imported target.
``PNG_FOUND`` ``PNG_FOUND``
If false, do not try to use PNG. True if PNG library is found.
``PNG_VERSION_STRING`` ``PNG_VERSION_STRING``
the version of the PNG library found (since CMake 2.8.8) .. versionadded:: 2.8.8
Obsolete variables The version of the PNG library found.
Obsolete Variables
^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^
The following variables may also be set, for backwards compatibility: The following variables may also be set for backward compatibility:
``PNG_LIBRARY`` ``PNG_LIBRARY``
where to find the PNG library. Path to the PNG library.
``PNG_INCLUDE_DIR`` ``PNG_INCLUDE_DIR``
where to find the PNG headers (same as PNG_INCLUDE_DIRS) Directory containing the PNG headers (same as ``PNG_INCLUDE_DIRS``).
Since PNG depends on the ZLib compression library, none of the above Examples
will be defined unless ZLib can be found. ^^^^^^^^
Finding PNG library and using it in a project:
.. code-block:: cmake
find_package(PNG)
target_link_libraries(project_target PRIVATE PNG::PNG)
#]=======================================================================] #]=======================================================================]
cmake_policy(PUSH) cmake_policy(PUSH)