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.
Added in version 3.5.
This module defines the following Imported Targets:
PNG::PNGThe libpng library, if found.
This module sets the following variables:
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 the PNG::PNG
imported target.
PNG_FOUNDTrue if PNG library is found.
PNG_VERSION_STRINGThe version of the PNG library found.
The following variables may also be set for backward compatibility:
PNG_LIBRARYPath to the PNG library.
PNG_INCLUDE_DIRDirectory containing the PNG headers (same as PNG_INCLUDE_DIRS).
Finding PNG library and using it in a project:
find_package(PNG)
target_link_libraries(project_target PRIVATE PNG::PNG)