FindLibXml2: Update documentation

- Added examples section.
- Synced module documentation with other similar find modules.
- Removed duplicated LIBXML2_INCLUDE_DIR variable description.
This commit is contained in:
Peter Kokot
2025-04-06 19:59:16 +02:00
parent 8d034572fd
commit 923c432f08

View File

@@ -5,51 +5,64 @@
FindLibXml2
-----------
Find the XML processing library (libxml2).
Finds the XML processing library (libxml2).
Imported Targets
^^^^^^^^^^^^^^^^
.. versionadded:: 3.12
The following :prop_tgt:`IMPORTED` targets may be defined:
This module provides the following :ref:`Imported Targets`:
``LibXml2::LibXml2``
libxml2 library.
.. versionadded:: 3.12
Target encapsulating the libxml2 library usage requirements, available only if
library is found.
``LibXml2::xmllint``
.. versionadded:: 3.17
xmllint command-line executable.
Target encapsulating the xmllint command-line executable, available only if
xmllint executable is found.
Result variables
Result Variables
^^^^^^^^^^^^^^^^
This module will set the following variables in your project:
This module defines the following variables:
``LibXml2_FOUND``
true if libxml2 headers and libraries were found
``LIBXML2_INCLUDE_DIR``
the directory containing LibXml2 headers
Boolean indicating whether the libxml2 library is found.
``LIBXML2_INCLUDE_DIRS``
list of the include directories needed to use LibXml2
Include directories needed to use the libxml2 library.
``LIBXML2_LIBRARIES``
LibXml2 libraries to be linked
Libraries needed to link against to use the libxml2 library.
``LIBXML2_DEFINITIONS``
the compiler switches required for using LibXml2
``LIBXML2_XMLLINT_EXECUTABLE``
path to the XML checking tool xmllint coming with LibXml2
The compiler switches required for using libxml2.
``LIBXML2_VERSION_STRING``
the version of LibXml2 found (since CMake 2.8.8)
.. versionadded:: 2.8.8
Cache variables
The version of the libxml2 found.
Cache Variables
^^^^^^^^^^^^^^^
The following cache variables may also be set:
``LIBXML2_INCLUDE_DIR``
the directory containing LibXml2 headers
The include directory containing libxml2 headers.
``LIBXML2_LIBRARY``
path to the LibXml2 library
The path to the libxml2 library.
``LIBXML2_XMLLINT_EXECUTABLE``
The path to the XML checking tool ``xmllint`` coming with libxml2.
Examples
^^^^^^^^
Finding the libxml2 library and linking it to a project target:
.. code-block:: cmake
find_package(LibXml2)
target_link_libraries(project_target PRIVATE LibXml2::LibXml2)
#]=======================================================================]
cmake_policy(PUSH)