@@ -40,14 +40,12 @@ project_build_root = meson.current_build_dir()
40
40
41
41
cpp_compiler = meson .get_compiler(' cpp' )
42
42
cpp_compiler_id = cpp_compiler.get_id()
43
- is_msvc = cpp_compiler_id == ' msvc' or cpp_compiler_id.endswith(' -cl' )
44
- is_cl_impersonator = is_msvc and cpp_compiler_id != ' msvc'
43
+ is_msvc_style = cpp_compiler.get_argument_syntax() == ' msvc'
45
44
python3 = find_program (' python3' , version : ' >=3.7' )
46
45
47
- # MSVC: We currently do not support shared and static builds at the,
48
- # same time, since we need different defines/cflags for proper
49
- # linking.
50
- if is_msvc
46
+ # MSVC: We currently do not support shared and static builds at the same time,
47
+ # since we need different defines/cflags for proper linking.
48
+ if is_msvc_style
51
49
if get_option (' default_library' ) == ' both'
52
50
error (' -Ddefault_library=both is currently not supported for Visual Studio' )
53
51
endif
@@ -120,11 +118,11 @@ benchmark_dep = dependency('boost', modules: ['system', 'timer'],
120
118
version : ' >=1.20.0' , required : do_benchmark)
121
119
can_benchmark = benchmark_dep.found()
122
120
123
- if is_msvc and not is_cl_impersonator
121
+ if is_msvc_style
124
122
# We must have Visual Studio 2017 15.7 or later...
125
- assert ( cpp_compiler.version().split( ' . ' )[ 0 ].to_int() >= 19 and \
126
- cpp_compiler.version().split( ' . ' )[ 1 ].to_int() >= 15 ,
127
- ' Visual Studio 2017 15.7 or later is required' )
123
+ mscver = cpp_compiler.get_define( ' _MSC_VER ' )
124
+ assert (mscver == '' or mscver.version_compare( ' >=1914 ' ) ,
125
+ ' Visual Studio 2017 15.7 or later or compatible is required' )
128
126
endif
129
127
130
128
# Some dependencies are required only in maintainer mode and/or
@@ -185,17 +183,17 @@ endif
185
183
warning_flags = []
186
184
if cpp_warnings == ' min'
187
185
if warning_level == 0
188
- warning_flags = is_msvc ? [' /W2' ] : [' -Wall' ]
189
- endif
186
+ warning_flags = is_msvc_style ? [' /W2' ] : [' -Wall' ]
187
+ endif
190
188
elif cpp_warnings == ' max' or cpp_warnings == ' fatal'
191
189
if warning_level < 3
192
- warning_flags = is_msvc ? [' /W4' ] : [' -pedantic' , ' -Wall' , ' -Wextra' ]
190
+ warning_flags = is_msvc_style ? [' /W4' ] : [' -pedantic' , ' -Wall' , ' -Wextra' ]
193
191
endif
194
- if not is_msvc
192
+ if not is_msvc_style
195
193
warning_flags += ' -Wsuggest-override -Wshadow -Wzero-as-null-pointer-constant -Wformat-security' .split()
196
194
endif
197
195
if cpp_warnings == ' fatal' and not werror
198
- warning_flags += is_msvc ? [' /WX' ] : [' -Werror' ]
196
+ warning_flags += is_msvc_style ? [' /WX' ] : [' -Werror' ]
199
197
endif
200
198
endif
201
199
@@ -206,7 +204,7 @@ add_project_arguments(warning_flags, language: 'cpp')
206
204
# that should not be overlooked stand out.
207
205
static_cxxflag = ' -DLIBSIGCXX_STATIC'
208
206
msvc_static_cxxflag = is_msvc_static ? static_cxxflag : ''
209
- if is_msvc
207
+ if is_msvc_style
210
208
disable_warnings_list = [
211
209
' /EHsc' , # avoid warnings caused by exception handling model used
212
210
]
0 commit comments