summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/FindLibXml2.cmake46
1 files changed, 34 insertions, 12 deletions
diff --git a/Modules/FindLibXml2.cmake b/Modules/FindLibXml2.cmake
index 613f927..f68628d 100644
--- a/Modules/FindLibXml2.cmake
+++ b/Modules/FindLibXml2.cmake
@@ -5,18 +5,37 @@
# FindLibXml2
# -----------
#
-# Try to find the LibXml2 xml processing library
+# Find the XML processing library (libxml2).
#
-# Once done this will define
+# Result variables
+# ^^^^^^^^^^^^^^^^
#
-# ::
+# This module will set the following variables in your project:
#
-# LIBXML2_FOUND - System has LibXml2
-# LIBXML2_INCLUDE_DIR - The LibXml2 include directory
-# LIBXML2_LIBRARIES - The libraries needed to use LibXml2
-# LIBXML2_DEFINITIONS - Compiler switches required for using LibXml2
-# LIBXML2_XMLLINT_EXECUTABLE - The XML checking tool xmllint coming with LibXml2
-# LIBXML2_VERSION_STRING - the version of LibXml2 found (since CMake 2.8.8)
+# ``LIBXML2_FOUND``
+# true if libxml2 headers and libraries were found
+# ``LIBXML2_INCLUDE_DIR``
+# the directory containing LibXml2 headers
+# ``LIBXML2_INCLUDE_DIRS``
+# list of the include directories needed to use LibXml2
+# ``LIBXML2_LIBRARIES``
+# LibXml2 libraries to be linked
+# ``LIBXML2_DEFINITIONS``
+# the compiler switches required for using LibXml2
+# ``LIBXML2_XMLLINT_EXECUTABLE``
+# path to the XML checking tool xmllint coming with LibXml2
+# ``LIBXML2_VERSION_STRING``
+# the version of LibXml2 found (since CMake 2.8.8)
+#
+# Cache variables
+# ^^^^^^^^^^^^^^^
+#
+# The following cache variables may also be set:
+#
+# ``LIBXML2_INCLUDE_DIR``
+# the directory containing LibXml2 headers
+# ``LIBXML2_LIBRARY``
+# path to the LibXml2 library
# use pkg-config to get the directories and then use these values
# in the find_path() and find_library() calls
@@ -31,7 +50,7 @@ find_path(LIBXML2_INCLUDE_DIR NAMES libxml/xpath.h
PATH_SUFFIXES libxml2
)
-find_library(LIBXML2_LIBRARIES NAMES xml2 libxml2
+find_library(LIBXML2_LIBRARY NAMES xml2 libxml2
HINTS
${PC_LIBXML_LIBDIR}
${PC_LIBXML_LIBRARY_DIRS}
@@ -52,9 +71,12 @@ elseif(LIBXML2_INCLUDE_DIR AND EXISTS "${LIBXML2_INCLUDE_DIR}/libxml/xmlversion.
unset(libxml2_version_str)
endif()
+set(LIBXML2_INCLUDE_DIRS ${LIBXML2_INCLUDE_DIR} ${PC_LIBXML_INCLUDE_DIRS})
+set(LIBXML2_LIBRARIES ${LIBXML2_LIBRARY})
+
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2
- REQUIRED_VARS LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR
+ REQUIRED_VARS LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR
VERSION_VAR LIBXML2_VERSION_STRING)
-mark_as_advanced(LIBXML2_INCLUDE_DIR LIBXML2_LIBRARIES LIBXML2_XMLLINT_EXECUTABLE)
+mark_as_advanced(LIBXML2_INCLUDE_DIR LIBXML2_LIBRARY LIBXML2_XMLLINT_EXECUTABLE)