FindPNG¶
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¶
Added in version 3.5.
This module defines the following Imported Targets:
PNG::PNGThe libpng library, if found.
Result Variables¶
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 thePNG::PNGimported target.PNG_FOUNDTrue if PNG library is found.
PNG_VERSION_STRINGThe version of the PNG library found.
Obsolete Variables¶
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).
Examples¶
Finding PNG library and using it in a project:
find_package(PNG)
target_link_libraries(project_target PRIVATE PNG::PNG)