Skip to content

Commit cc48aae

Browse files
committed
Meson: Compensate for the lack of msvc_recommended_pragmas.h
libxml++-5.x and later no longer depends on glibmm (hence GLib), so msvc_recommended_pragmas.h may not be available. If it isn't, disable warnings C4244 and C4101 to compensate for it.
1 parent 36d88bf commit cc48aae

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

meson.build

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,12 +267,23 @@ add_project_arguments(warning_flags, language: 'cpp')
267267
# that should not be overlooked stand out.
268268
if is_msvc
269269
disable_warnings_list = [
270-
'/FImsvc_recommended_pragmas.h', # Turn off harmless warnings but make potentially
271-
# dangerous ones glaring, distributed with GLib
272270
'/EHsc', # avoid warnings caused by exception handling model used
273271
'/utf-8', # Avoid C4819 unicode conversion warnings when building on CJK locales
274272
'/wd4706', # assignment within conditional expression
275273
]
274+
275+
# Turn off harmless warnings but make potentially dangerous ones glaring,
276+
# distributed with GLib, if available
277+
use_recommended_pragmas = cpp_compiler.get_supported_arguments('/FImsvc_recommended_pragmas.h')
278+
if use_recommended_pragmas.length() > 0
279+
add_project_arguments(use_recommended_pragmas, language: 'cpp')
280+
else
281+
disable_warnings_list += [
282+
'/wd4244', # 'conversion' conversion from 'type1' to 'type2', possible loss of data
283+
'/wd4101', # unreferenced local variable
284+
]
285+
endif
286+
276287
if host_machine.cpu_family() == 'x86_64' or host_machine.cpu_family() == 'aarch64'
277288
# 'var' : conversion from 'size_t' to 'type', possible loss of data (applies on 64-bit builds)
278289
disable_warnings_list += '/wd4267'

0 commit comments

Comments
 (0)