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