FindPNG¶
Finds libpng, the official reference library for the PNG image format:
find_package(PNG [<version>] [...])
備註
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::PNG
在 3.5 版被加入.
Target encapsulating the libpng library usage requirements, available if libpng is found.
結果變數¶
該模組定義了以下變數:
PNG_FOUND
Boolean indicating whether the (requested version of) PNG library was found.
PNG_VERSION
在 4.2 版被加入.
The version of the PNG library found.
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.
已棄用的變數¶
The following variables may also be set for backward compatibility:
PNG_LIBRARY
在 3.0 版之後被棄用: Use the
PNG::PNG
imported target.Path to the PNG library.
PNG_INCLUDE_DIR
在 3.0 版之後被棄用: Use the
PNG::PNG
imported target.Directory containing the PNG headers (same as
PNG_INCLUDE_DIRS
).PNG_VERSION_STRING
在 4.2 版之後被棄用: Superseded by the
PNG_VERSION
.The version of the PNG library found.
範例¶
Finding PNG library and using it in a project:
find_package(PNG)
target_link_libraries(project_target PRIVATE PNG::PNG)