FindPNG

Finds libpng, the official reference library for the PNG image format.

备注

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::PNG

The libpng library, if found.

Result Variables

This module sets the following variables:

PNG_INCLUDE_DIRS

Directory containing the PNG headers (e.g., png.h).

PNG_LIBRARIES

PNG libraries required for linking.

PNG_DEFINITIONS

Compile definitions for using PNG, if any. They can be added with target_compile_definitions() command when not using the PNG::PNG imported target.

PNG_FOUND

True if PNG library is found.

PNG_VERSION_STRING

The version of the PNG library found.

Obsolete Variables

The following variables may also be set for backward compatibility:

PNG_LIBRARY

Path to the PNG library.

PNG_INCLUDE_DIR

Directory 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)