From 0bd3ae2a0c096c16f8232ad09d24df7768fc991a Mon Sep 17 00:00:00 2001 From: Ignacio Casal Quinteiro Date: Mon, 21 Jan 2019 12:20:53 +0100 Subject: [PATCH] meson: on msvc icu installs the libraries with a "d" suffix --- meson.build | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 4c1e57d..773e6af 100644 --- a/meson.build +++ b/meson.build @@ -7,6 +7,10 @@ cc = meson.get_compiler('c') enable_runtime = get_option('runtime') enable_builtin = get_option('builtin') +# We need to know the build type to determine what .lib files we need on Visual Studio +# for dependencies that don't normally come with pkg-config files for Visual Studio builds +buildtype = get_option('buildtype') + notfound = dependency('', required : false) libidn2_dep = notfound libicu_dep = notfound @@ -38,7 +42,14 @@ endif if ['libicu', 'auto'].contains(enable_runtime) or ['libicu', 'auto'].contains(enable_builtin) libicu_dep = dependency('icu-uc', required : false) if not libicu_dep.found() and cc.has_header('unicode/ustring.h') - libicu_dep = cc.find_library('icuuc', required : false) + # MSVC: the debug configuration of ICU generated the libraries with d suffix + # we must handle this and search for the right library depending on the + # build type. Note debugoptimized is just a release build with .pdb files enabled + if cc.get_id() == 'msvc' and buildtype == 'debug' + libicu_dep = cc.find_library('icuucd', required : false) + else + libicu_dep = cc.find_library('icuuc', required : false) + endif endif if libicu_dep.found() if enable_runtime == 'auto'