Skip to content

Commit

Permalink
build: only add warning flags if supported
Browse files Browse the repository at this point in the history
  • Loading branch information
mochaaP committed Jan 2, 2025
1 parent cb4a6eb commit cfd7303
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,30 @@ project(
'c',
version: '5.0-dev',
license: 'MIT',
default_options: ['c_std=c11', 'warning_level=3', 'default_library=static']
default_options: ['c_std=c11', 'warning_level=3', 'default_library=static'],
meson_version: '>=1.1',
)

stcversion = 5
cc = meson.get_compiler('c')

if cc.get_id() == 'gcc'
add_project_arguments('-Wno-missing-field-initializers', '-Wno-stringop-overflow', '-Wno-clobbered', language: ['c', 'cpp'])
elif cc.get_id() == 'clang'
add_project_arguments('-Wno-missing-field-initializers', language: ['c', 'cpp'])
elif cc.get_id() == 'msvc'
add_project_arguments('-wd4996', language: ['c', 'cpp']) # no "unsecure" funcs warnings
if cc.get_argument_syntax() == 'gcc'
add_project_arguments(
cc.get_supported_arguments(
'-Wno-missing-field-initializers',
'-Wno-stringop-overflow',
'-Wno-clobbered',
),
language: ['c', 'cpp'],
)
elif cc.get_argument_syntax() == 'msvc'
# no "unsecure" funcs warnings
add_project_arguments(
cc.get_supported_arguments(
'-wd4996',
),
language: ['c', 'cpp'],
)
endif

libsrc = files(
Expand Down

0 comments on commit cfd7303

Please sign in to comment.