[gtksourceview/meson-libxml2] build: Also try finding libxml2 with CMake




commit ee13281c2211c3e6a584d1685fa9572a7793b6d0
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Fri Jun 24 10:14:58 2022 +0800

    build: Also try finding libxml2 with CMake
    
    For Windows builds of libxml2, one may be using its supplied NMake Makefiles
    to build libxml2, which do not have complete pkg-config files, or use CMake,
    which optionally crafts its pkg-config files that may need some tinkering for
    proper use.
    
    Instead, save from such issues to try finding again libxml2 with CMake, which
    actually manually search for libxml2's headers and libraries like what we used
    to do, for us, if a proper pkg-config file cannot be found by Meson, before we
    resort to the fallback.
    
    If at one point we require Meson 0.60.0 (or so) or later, we can just put the
    package strings that we want to search for in a form like
    ['libxml-2.0', 'LibXml2'], but let's just do this for the time being.
    
    The "LibXml2" format follows the CMake docs at [1].
    
    [1]: https://cmake.org/cmake/help/latest/module/FindLibXml2.html

 meson.build | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/meson.build b/meson.build
index fe961bb5..475d2d50 100644
--- a/meson.build
+++ b/meson.build
@@ -84,8 +84,19 @@ glib_dep = dependency('glib-2.0', version: glib_req)
 gobject_dep = dependency('gobject-2.0', version: glib_req)
 gio_dep = dependency('gio-2.0', version: glib_req)
 gtk_dep = dependency('gtk4', version: gtk_req)
-libxml_dep = dependency('libxml-2.0', version: libxml_req,
-                        fallback : ['libxml2', 'xml2lib_dep'])
+
+libxml_dep = dependency('libxml-2.0',
+                        method: 'pkg-config',
+                        version: libxml_req,
+                        required : false)
+
+if not libxml_dep.found()
+  libxml_dep = dependency('LibXml2',
+                          method: 'cmake',
+                          version: libxml_req,
+                          fallback : ['libxml2', 'xml2lib_dep'])
+endif
+
 fribidi_dep = dependency('fribidi', version: fribidi_req)
 fontconfig_dep = dependency('fontconfig', required: false)
 pangoft2_dep = dependency('pangoft2', required: false)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]