mirror of
https://github.com/reactos/CMake.git
synced 2024-12-12 13:56:00 +00:00
FindLibXml2: Switch to standard module variable names
* LIBXML2_INCLUDE_DIR talks about libxml2 itself; * LIBXML2_INCLUDE_DIRS lists also include directories coming from libxml2's dependencies and is what libxml2 users should use; * LIBXML2_LIBRARY talks about libxml2 itself; * LIBXML2_LIBRARIES is what libxml2 users should link to. This commit doesn't break existing users of FindLibXml2.cmake, but provides the way for correct behaviour in future. In particular, on OpenBSD LIBXML2_INCLUDE_DIR resolves to /usr/local/include/libxml2, while libiconv (an libxml2 dependency) puts iconv.h in /usr/local/include, which is not picked up automatically.
This commit is contained in:
parent
fc58819150
commit
a1b3886556
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user