VirtualBox

source: vbox/trunk/src/libs/libxml2-2.12.6/libxml2-config.cmake.in@ 104932

Last change on this file since 104932 was 104106, checked in by vboxsync, 9 months ago

libxml2-2.9.14: Applied and adjusted our libxml2 changes to 2.9.14. bugref:10640

  • Property svn:eol-style set to native
File size: 5.5 KB
Line 
1# libxml2-config.cmake
2# --------------------
3#
4# Libxml2 cmake module.
5# This module sets the following variables:
6#
7# ::
8#
9# LIBXML2_INCLUDE_DIR - Directory where LibXml2 headers are located.
10# LIBXML2_INCLUDE_DIRS - list of the include directories needed to use LibXml2.
11# LIBXML2_LIBRARY - path to the LibXml2 library.
12# LIBXML2_LIBRARIES - xml2 libraries to link against.
13# LIBXML2_DEFINITIONS - the compiler switches required for using LibXml2.
14# LIBXML2_VERSION_MAJOR - The major version of libxml2.
15# LIBXML2_VERSION_MINOR - The minor version of libxml2.
16# LIBXML2_VERSION_PATCH - The patch version of libxml2.
17# LIBXML2_VERSION_STRING - version number as a string (ex: "2.3.4")
18# LIBXML2_MODULES - whether libxml2 has dso support
19# LIBXML2_XMLLINT_EXECUTABLE - path to the XML checking tool xmllint coming with LibXml2
20#
21# The following targets are defined:
22#
23# LibXml2::LibXml2 - the LibXml2 library
24# LibXml2::xmllint - the xmllint command-line executable
25
26get_filename_component(_libxml2_rootdir ${CMAKE_CURRENT_LIST_DIR}/../../../ ABSOLUTE)
27
28set(LIBXML2_VERSION_MAJOR @LIBXML_MAJOR_VERSION@)
29set(LIBXML2_VERSION_MINOR @LIBXML_MINOR_VERSION@)
30set(LIBXML2_VERSION_MICRO @LIBXML_MICRO_VERSION@)
31set(LIBXML2_VERSION_STRING "@VERSION@")
32set(LIBXML2_DEFINITIONS "@XML_CFLAGS@")
33set(LIBXML2_INSTALL_PREFIX ${_libxml2_rootdir})
34set(LIBXML2_INCLUDE_DIR ${_libxml2_rootdir}/include/libxml2)
35set(LIBXML2_LIBRARY_DIR ${_libxml2_rootdir}/lib)
36
37find_library(LIBXML2_LIBRARY NAMES xml2 HINTS ${LIBXML2_LIBRARY_DIR} NO_DEFAULT_PATH)
38find_program(LIBXML2_XMLCATALOG_EXECUTABLE NAMES xmlcatalog HINTS ${_libxml2_rootdir}/bin NO_DEFAULT_PATH)
39find_program(LIBXML2_XMLLINT_EXECUTABLE NAMES xmllint HINTS ${_libxml2_rootdir}/bin NO_DEFAULT_PATH)
40
41set(LIBXML2_LIBRARIES ${LIBXML2_LIBRARY})
42set(LIBXML2_INCLUDE_DIRS ${LIBXML2_INCLUDE_DIR})
43unset(LIBXML2_INTERFACE_LINK_LIBRARIES)
44
45include(CMakeFindDependencyMacro)
46
47set(LIBXML2_WITH_ICONV @WITH_ICONV@)
48set(LIBXML2_WITH_THREADS @WITH_THREADS@)
49set(LIBXML2_WITH_ICU @WITH_ICU@)
50set(LIBXML2_WITH_LZMA @WITH_LZMA@)
51set(LIBXML2_WITH_ZLIB @WITH_ZLIB@)
52
53if(LIBXML2_WITH_ICONV)
54 find_dependency(Iconv)
55 list(APPEND LIBXML2_LIBRARIES ${Iconv_LIBRARIES})
56 list(APPEND LIBXML2_INCLUDE_DIRS ${Iconv_INCLUDE_DIRS})
57 list(APPEND LIBXML2_INTERFACE_LINK_LIBRARIES "Iconv::Iconv")
58 if(NOT Iconv_FOUND)
59 set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
60 set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "Iconv dependency was not found")
61 return()
62 endif()
63endif()
64
65if(LIBXML2_WITH_THREADS)
66 find_dependency(Threads)
67 list(APPEND LIBXML2_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
68 list(APPEND LIBXML2_INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:Threads::Threads>")
69 if(NOT Threads_FOUND)
70 set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
71 set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "Threads dependency was not found")
72 return()
73 endif()
74endif()
75
76if(LIBXML2_WITH_ICU)
77 find_dependency(ICU COMPONENTS data i18n uc)
78 list(APPEND LIBXML2_LIBRARIES ${ICU_LIBRARIES})
79 list(APPEND LIBXML2_INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:ICU::data>;\$<LINK_ONLY:ICU::i18n>;\$<LINK_ONLY:ICU::uc>")
80 if(NOT ICU_FOUND)
81 set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
82 set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "ICU dependency was not found")
83 return()
84 endif()
85endif()
86
87if(LIBXML2_WITH_LZMA)
88 find_dependency(LibLZMA)
89 list(APPEND LIBXML2_LIBRARIES ${LIBLZMA_LIBRARIES})
90 list(APPEND LIBXML2_INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:LibLZMA::LibLZMA>")
91 if(NOT LibLZMA_FOUND)
92 set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
93 set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "LibLZMA dependency was not found")
94 return()
95 endif()
96endif()
97
98if(LIBXML2_WITH_ZLIB)
99 find_dependency(ZLIB)
100 list(APPEND LIBXML2_LIBRARIES ${ZLIB_LIBRARIES})
101 list(APPEND LIBXML2_INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:ZLIB::ZLIB>")
102 if(NOT ZLIB_FOUND)
103 set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
104 set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "ZLIB dependency was not found")
105 return()
106 endif()
107endif()
108
109if(UNIX)
110 list(APPEND LIBXML2_LIBRARIES m)
111 list(APPEND LIBXML2_INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:m>")
112endif()
113
114if(WIN32)
115 list(APPEND LIBXML2_LIBRARIES ws2_32)
116 list(APPEND LIBXML2_INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:ws2_32>")
117endif()
118
119# whether libxml2 has dso support
120set(LIBXML2_MODULES @WITH_MODULES@)
121
122mark_as_advanced(LIBXML2_LIBRARY LIBXML2_XMLCATALOG_EXECUTABLE LIBXML2_XMLLINT_EXECUTABLE)
123
124if(NOT TARGET LibXml2::LibXml2 AND DEFINED LIBXML2_LIBRARY AND DEFINED LIBXML2_INCLUDE_DIRS)
125 add_library(LibXml2::LibXml2 UNKNOWN IMPORTED)
126 set_target_properties(LibXml2::LibXml2 PROPERTIES IMPORTED_LOCATION "${LIBXML2_LIBRARY}")
127 set_target_properties(LibXml2::LibXml2 PROPERTIES INTERFACE_COMPILE_OPTIONS "${LIBXML2_DEFINITIONS}")
128 set_target_properties(LibXml2::LibXml2 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LIBXML2_INCLUDE_DIRS}")
129 set_target_properties(LibXml2::LibXml2 PROPERTIES INTERFACE_LINK_LIBRARIES "${LIBXML2_INTERFACE_LINK_LIBRARIES}")
130endif()
131
132if(NOT TARGET LibXml2::xmlcatalog AND DEFINED LIBXML2_XMLCATALOG_EXECUTABLE)
133 add_executable(LibXml2::xmlcatalog IMPORTED)
134 set_target_properties(LibXml2::xmlcatalog PROPERTIES IMPORTED_LOCATION "${LIBXML2_XMLCATALOG_EXECUTABLE}")
135endif()
136
137if(NOT TARGET LibXml2::xmllint AND DEFINED LIBXML2_XMLLINT_EXECUTABLE)
138 add_executable(LibXml2::xmllint IMPORTED)
139 set_target_properties(LibXml2::xmllint PROPERTIES IMPORTED_LOCATION "${LIBXML2_XMLLINT_EXECUTABLE}")
140endif()
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette