FindZLIB¶
Finds the native zlib data compression library:
find_package(ZLIB [<version>] [...])
Imported Targets¶
This module provides the following Imported Targets:
ZLIB::ZLIB在 3.1 版被加入.
Target that encapsulates the zlib usage requirements. It is available only when zlib is found.
結果變數¶
該模組定義了以下變數:
ZLIB_FOUNDBoolean indicating whether (the requested version of) zlib was found.
ZLIB_VERSION在 3.26 版被加入.
The version of zlib found.
ZLIB_INCLUDE_DIRSInclude directories containing
zlib.hand other headers needed to use zlib.ZLIB_LIBRARIESList of libraries needed to link to zlib.
在 3.4 版的變更: Debug and Release library variants can be now found separately.
提示¶
This module accepts the following variables:
ZLIB_ROOTA user may set this variable to a zlib installation root to help locate zlib in custom installation paths.
ZLIB_USE_STATIC_LIBS在 3.24 版被加入.
Set this variable to
ONbefore callingfind_package(ZLIB)to look for static libraries. Default isOFF.
已棄用的變數¶
The following variables are provided for backward compatibility:
ZLIB_VERSION_MAJOR在 3.26 版之後被棄用: Superseded by
ZLIB_VERSION.The major version of zlib.
ZLIB_VERSION_MINOR在 3.26 版之後被棄用: Superseded by
ZLIB_VERSION.The minor version of zlib.
ZLIB_VERSION_PATCH在 3.26 版之後被棄用: Superseded by
ZLIB_VERSION.The patch version of zlib.
ZLIB_VERSION_TWEAK在 3.26 版之後被棄用: Superseded by
ZLIB_VERSION.The tweak version of zlib.
ZLIB_VERSION_STRING在 3.26 版之後被棄用: Superseded by
ZLIB_VERSION.The version of zlib found (x.y.z).
ZLIB_MAJOR_VERSION在 3.26 版之後被棄用: Superseded by
ZLIB_VERSION.The major version of zlib.
ZLIB_MINOR_VERSION在 3.26 版之後被棄用: Superseded by
ZLIB_VERSION.The minor version of zlib.
ZLIB_PATCH_VERSION在 3.26 版之後被棄用: Superseded by
ZLIB_VERSION.The patch version of zlib.
範例¶
Finding zlib and linking it to a project target:
find_package(ZLIB)
target_link_libraries(project_target PRIVATE ZLIB::ZLIB)