VirtualBox

source: vbox/trunk/src/libs/libxml2-2.13.2/libxml2-config.cmake.in@ 105764

最後變更 在這個檔案從105764是 105420,由 vboxsync 提交於 4 月 前

libxml2-2.12.6: Applied and adjusted our libxml2 changes to 2.12.6. bugref:10730

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

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