FindPNG¶
Finds libpng, the official reference library for the PNG image format:
find_package(PNG [<version>] [...])
Note
The PNG library depends on the ZLib compression library, which must be found for this module to succeed.
Imported Targets¶
This module provides the following Imported Targets:
PNG::PNGAdded in version 3.5.
Target encapsulating the libpng library usage requirements, available if libpng is found.
Result Variables¶
This module defines the following variables:
PNG_FOUNDBoolean indicating whether the (requested version of) PNG library was found.
PNG_VERSIONAdded in version 4.2.
The version of the PNG library found.
PNG_INCLUDE_DIRSDirectory containing the PNG headers (e.g.,
png.h).PNG_LIBRARIESPNG libraries required for linking.
PNG_DEFINITIONSCompile definitions for using PNG, if any. They can be added with
target_compile_definitions()command when not using thePNG::PNGimported target.
Deprecated Variables¶
The following variables may also be set for backward compatibility:
PNG_LIBRARYDeprecated since version 3.0: Use the
PNG::PNGimported target.Path to the PNG library.
PNG_INCLUDE_DIRDeprecated since version 3.0: Use the
PNG::PNGimported target.Directory containing the PNG headers (same as
PNG_INCLUDE_DIRS).PNG_VERSION_STRINGDeprecated since version 4.2: Superseded by the
PNG_VERSION.The version of the PNG library found.
Examples¶
Finding PNG library and using it in a project:
find_package(PNG)
target_link_libraries(project_target PRIVATE PNG::PNG)