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¶
在 3.5 版被加入.
This module defines the following Imported Targets:
PNG::PNG
The libpng library, if found.
結果變數¶
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 thePNG::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
).
範例¶
Finding PNG library and using it in a project:
find_package(PNG)
target_link_libraries(project_target PRIVATE PNG::PNG)