meson: Always look for both cmake and pkgconfig names
authorNirbheek Chauhan <nirbheek@centricular.com>
Sun, 18 Dec 2022 01:24:44 +0000 (06:54 +0530)
committerNirbheek Chauhan <nirbheek@centricular.com>
Sun, 18 Dec 2022 16:12:03 +0000 (21:42 +0530)
The is_msvc_like change is wrong; it used a false correlation between
"compiler being used" and "dependency method" by saying that on
Windows, when building with MSVC, you will only use CMake to find png,
jpeg, tiff.

You can use pkgconfig to find these deps on Windows with MSVC -- when
the deps have been built with Autotools or Meson (with MSVC). You can
also find these deps using CMake on other platforms like macOS or
Linux.

The solution is simple: just search for both names on all platforms,
and just search for the pkgconfig name first.

meson.build

index cabe74c30d49d53031c66a26a15ac28a0a1a97d1..a485363358b19a453210f4b80da76f47457214c4 100644 (file)
@@ -410,22 +410,17 @@ if win32_enabled
   pangowin32_dep = dependency('pangowin32')
 endif
 
-is_msvc_like = cc.get_argument_syntax() == 'msvc'
-
 pangocairo_dep = dependency('pangocairo', version: pango_req,
                             fallback : ['pango', 'libpangocairo_dep'])
 pixbuf_dep     = dependency('gdk-pixbuf-2.0', version: gdk_pixbuf_req,
                             fallback : ['gdk-pixbuf', 'gdkpixbuf_dep'],
                             default_options: ['png=enabled', 'jpeg=enabled', 'builtin_loaders=png,jpeg', 'man=false'])
-png_dep        = dependency(is_msvc_like ? 'png' : 'libpng',
-                            fallback: ['libpng', 'libpng_dep'],
-                            required: true)
-tiff_dep       = dependency(is_msvc_like ? 'tiff' : 'libtiff-4',
-                            fallback: ['libtiff', 'libtiff4_dep'],
-                            required: true)
-jpeg_dep       = dependency(is_msvc_like ? 'jpeg' : 'libjpeg',
-                            fallback: ['libjpeg-turbo', 'jpeg_dep'],
-                            required: true)
+png_dep        = dependency('libpng', 'png',
+                            fallback: ['libpng', 'libpng_dep'])
+tiff_dep       = dependency('libtiff-4', 'tiff',
+                            fallback: ['libtiff', 'libtiff4_dep'])
+jpeg_dep       = dependency('libjpeg', 'jpeg',
+                            fallback: ['libjpeg-turbo', 'jpeg_dep'])
 
 epoxy_dep      = dependency('epoxy', version: epoxy_req,
                             fallback: ['libepoxy', 'libepoxy_dep'])