VirtualBox

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

Last change on this file since 105770 was 105420, checked in by vboxsync, 4 months ago

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

  • Property svn:eol-style set to native
File size: 6.9 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
21include("${CMAKE_CURRENT_LIST_DIR}/libxml2-export.cmake")
22
23@PACKAGE_INIT@
24
25set(LIBXML2_VERSION_MAJOR @LIBXML_MAJOR_VERSION@)
26set(LIBXML2_VERSION_MINOR @LIBXML_MINOR_VERSION@)
27set(LIBXML2_VERSION_PATCH @LIBXML_MICRO_VERSION@)
28set(LIBXML2_VERSION_STRING "@VERSION@")
29set(LIBXML2_INSTALL_PREFIX ${PACKAGE_PREFIX_DIR})
30set(LIBXML2_INCLUDE_DIR ${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_INCLUDEDIR@/libxml2)
31set(LIBXML2_LIBRARY_DIR ${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_LIBDIR@)
32
33macro(select_library_location target basename)
34 if(TARGET ${target})
35 foreach(property IN ITEMS IMPORTED_LOCATION IMPORTED_IMPLIB)
36 get_target_property(${basename}_${property}_DEBUG ${target} ${property}_DEBUG)
37 get_target_property(${basename}_${property}_MINSIZEREL ${target} ${property}_MINSIZEREL)
38 get_target_property(${basename}_${property}_NOCONFIG ${target} ${property}_NOCONFIG)
39 get_target_property(${basename}_${property}_RELEASE ${target} ${property}_RELEASE)
40 get_target_property(${basename}_${property}_RELWITHDEBINFO ${target} ${property}_RELWITHDEBINFO)
41
42 if(${basename}_${property}_DEBUG AND ${basename}_${property}_RELEASE)
43 set(${basename}_LIBRARY debug ${${basename}_${property}_DEBUG} optimized ${${basename}_${property}_RELEASE})
44 elseif(${basename}_${property}_DEBUG AND ${basename}_${property}_RELWITHDEBINFO)
45 set(${basename}_LIBRARY debug ${${basename}_${property}_DEBUG} optimized ${${basename}_${property}_RELWITHDEBINFO})
46 elseif(${basename}_${property}_DEBUG AND ${basename}_${property}_MINSIZEREL)
47 set(${basename}_LIBRARY debug ${${basename}_${property}_DEBUG} optimized ${${basename}_${property}_MINSIZEREL})
48 elseif(${basename}_${property}_RELEASE)
49 set(${basename}_LIBRARY ${${basename}_${property}_RELEASE})
50 elseif(${basename}_${property}_RELWITHDEBINFO)
51 set(${basename}_LIBRARY ${${basename}_${property}_RELWITHDEBINFO})
52 elseif(${basename}_${property}_MINSIZEREL)
53 set(${basename}_LIBRARY ${${basename}_${property}_MINSIZEREL})
54 elseif(${basename}_${property}_DEBUG)
55 set(${basename}_LIBRARY ${${basename}_${property}_DEBUG})
56 elseif(${basename}_${property}_NOCONFIG)
57 set(${basename}_LIBRARY ${${basename}_${property}_NOCONFIG})
58 endif()
59 endforeach()
60 endif()
61endmacro()
62
63macro(select_executable_location target basename)
64 if(TARGET ${target})
65 get_target_property(${basename}_IMPORTED_LOCATION_DEBUG ${target} IMPORTED_LOCATION_DEBUG)
66 get_target_property(${basename}_IMPORTED_LOCATION_MINSIZEREL ${target} IMPORTED_LOCATION_MINSIZEREL)
67 get_target_property(${basename}_IMPORTED_LOCATION_NOCONFIG ${target} IMPORTED_LOCATION_NOCONFIG)
68 get_target_property(${basename}_IMPORTED_LOCATION_RELEASE ${target} IMPORTED_LOCATION_RELEASE)
69 get_target_property(${basename}_IMPORTED_LOCATION_RELWITHDEBINFO ${target} IMPORTED_LOCATION_RELWITHDEBINFO)
70
71 if(${basename}_IMPORTED_LOCATION_RELEASE)
72 set(${basename}_EXECUTABLE ${${basename}_IMPORTED_LOCATION_RELEASE})
73 elseif(${basename}_IMPORTED_LOCATION_RELWITHDEBINFO)
74 set(${basename}_EXECUTABLE ${${basename}_IMPORTED_LOCATION_RELWITHDEBINFO})
75 elseif(${basename}_IMPORTED_LOCATION_MINSIZEREL)
76 set(${basename}_EXECUTABLE ${${basename}_IMPORTED_LOCATION_MINSIZEREL})
77 elseif(${basename}_IMPORTED_LOCATION_DEBUG)
78 set(${basename}_EXECUTABLE ${${basename}_IMPORTED_LOCATION_DEBUG})
79 elseif(${basename}_IMPORTED_LOCATION_NOCONFIG)
80 set(${basename}_EXECUTABLE ${${basename}_IMPORTED_LOCATION_NOCONFIG})
81 endif()
82 endif()
83endmacro()
84
85select_library_location(LibXml2::LibXml2 LIBXML2)
86select_executable_location(LibXml2::xmlcatalog LIBXML2_XMLCATALOG)
87select_executable_location(LibXml2::xmllint LIBXML2_XMLLINT)
88
89set(LIBXML2_LIBRARIES ${LIBXML2_LIBRARY})
90set(LIBXML2_INCLUDE_DIRS ${LIBXML2_INCLUDE_DIR})
91
92include(CMakeFindDependencyMacro)
93
94set(LIBXML2_SHARED @BUILD_SHARED_LIBS@)
95set(LIBXML2_WITH_ICONV @LIBXML2_WITH_ICONV@)
96set(LIBXML2_WITH_THREADS @LIBXML2_WITH_THREADS@)
97set(LIBXML2_WITH_ICU @LIBXML2_WITH_ICU@)
98set(LIBXML2_WITH_LZMA @LIBXML2_WITH_LZMA@)
99set(LIBXML2_WITH_ZLIB @LIBXML2_WITH_ZLIB@)
100
101if(LIBXML2_WITH_ICONV)
102 find_dependency(Iconv)
103 list(APPEND LIBXML2_LIBRARIES ${Iconv_LIBRARIES})
104 list(APPEND LIBXML2_INCLUDE_DIRS ${Iconv_INCLUDE_DIRS})
105 if(NOT Iconv_FOUND)
106 set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
107 set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "Iconv dependency was not found")
108 return()
109 endif()
110endif()
111
112if(NOT LIBXML2_SHARED)
113 set(LIBXML2_DEFINITIONS -DLIBXML_STATIC)
114
115 if(LIBXML2_WITH_THREADS)
116 find_dependency(Threads)
117 list(APPEND LIBXML2_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
118 if(NOT Threads_FOUND)
119 set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
120 set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "Threads dependency was not found")
121 return()
122 endif()
123 endif()
124
125 if(LIBXML2_WITH_ICU)
126 find_dependency(ICU COMPONENTS data i18n uc)
127 list(APPEND LIBXML2_LIBRARIES ${ICU_LIBRARIES})
128 if(NOT ICU_FOUND)
129 set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
130 set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "ICU dependency was not found")
131 return()
132 endif()
133 endif()
134
135 if(LIBXML2_WITH_LZMA)
136 find_dependency(LibLZMA)
137 list(APPEND LIBXML2_LIBRARIES ${LIBLZMA_LIBRARIES})
138 if(NOT LibLZMA_FOUND)
139 set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
140 set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "LibLZMA dependency was not found")
141 return()
142 endif()
143 endif()
144
145 if(LIBXML2_WITH_ZLIB)
146 find_dependency(ZLIB)
147 list(APPEND LIBXML2_LIBRARIES ${ZLIB_LIBRARIES})
148 if(NOT ZLIB_FOUND)
149 set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
150 set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "ZLIB dependency was not found")
151 return()
152 endif()
153 endif()
154
155 if(UNIX)
156 list(APPEND LIBXML2_LIBRARIES m)
157 endif()
158
159 if(WIN32)
160 list(APPEND LIBXML2_LIBRARIES ws2_32)
161 endif()
162endif()
163
164# whether libxml2 has dso support
165set(LIBXML2_MODULES @LIBXML2_WITH_MODULES@)
166
167mark_as_advanced(LIBXML2_LIBRARY LIBXML2_XMLCATALOG_EXECUTABLE LIBXML2_XMLLINT_EXECUTABLE)
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