FindLibXml2¶
Finds the XML processing library (libxml2):
find_package(LibXml2 [<version>] [...])
Imported Targets¶
This module provides the following Imported Targets:
LibXml2::LibXml2在 3.12 版被加入.
Target encapsulating the libxml2 library usage requirements, available only if library is found.
LibXml2::xmllint在 3.17 版被加入.
Target encapsulating the xmllint command-line executable, available only if xmllint executable is found.
結果變數¶
該模組定義了以下變數:
LibXml2_FOUND在 3.3 版被加入.
Boolean indicating whether the (requested version of) libxml2 library was found.
LibXml2_VERSION在 4.2 版被加入.
The version of the libxml2 found.
LIBXML2_INCLUDE_DIRSInclude directories needed to use the libxml2 library.
LIBXML2_LIBRARIESLibraries needed to link against to use the libxml2 library.
LIBXML2_DEFINITIONSThe compiler switches required for using libxml2.
Other Variables¶
LibXml2_USE_STATIC_LIBS在 4.3 版被加入.
Set to
TRUEto use static libraries. Default isFALSE.
快取變數¶
The following cache variables may also be set:
LIBXML2_INCLUDE_DIRThe include directory containing libxml2 headers.
LIBXML2_LIBRARYThe path to the libxml2 library.
LIBXML2_XMLLINT_EXECUTABLEThe path to the XML checking tool
xmllintcoming with libxml2.
已棄用的變數¶
The following variables are provided for backward compatibility:
LIBXML2_FOUND在 4.2 版之後被棄用: Use
LibXml2_FOUND, which has the same value.Boolean indicating whether the (requested version of) libxml2 library was found.
LIBXML2_VERSION_STRING在 4.2 版之後被棄用: Superseded by the
LibXml2_VERSION.The version of the libxml2 found.
範例¶
Finding the libxml2 library and linking it to a project target:
find_package(LibXml2)
target_link_libraries(project_target PRIVATE LibXml2::LibXml2)