meson.build: use add_project_arguments() instead of add_global_arguments()

Don't propagate MPD-specific compiler flags to subprojects.
This commit is contained in:
Max Kellermann 2021-05-25 20:49:27 +02:00
parent 281270cd2a
commit 48c7c540df
1 changed files with 17 additions and 7 deletions

View File

@ -42,16 +42,24 @@ common_cppflags = [
'-D_GNU_SOURCE', '-D_GNU_SOURCE',
] ]
test_global_common_flags = [
'-fvisibility=hidden',
]
test_common_flags = [ test_common_flags = [
'-Wvla', '-Wvla',
'-Wdouble-promotion', '-Wdouble-promotion',
'-fvisibility=hidden',
'-ffast-math', '-ffast-math',
'-ftree-vectorize', '-ftree-vectorize',
] ]
test_global_cxxflags = test_global_common_flags + [
]
test_global_cflags = test_global_common_flags + [
]
test_cxxflags = test_common_flags + [ test_cxxflags = test_common_flags + [
'-fno-threadsafe-statics', '-fno-threadsafe-statics',
'-fmerge-all-constants', '-fmerge-all-constants',
@ -91,11 +99,11 @@ test_ldflags = [
] ]
if get_option('buildtype') != 'debug' if get_option('buildtype') != 'debug'
test_cxxflags += [ test_global_cxxflags += [
'-ffunction-sections', '-ffunction-sections',
'-fdata-sections', '-fdata-sections',
] ]
test_cflags += [ test_global_cflags += [
'-ffunction-sections', '-ffunction-sections',
'-fdata-sections', '-fdata-sections',
] ]
@ -114,9 +122,11 @@ if get_option('fuzzer')
add_global_link_arguments(fuzzer_flags, language: 'cpp') add_global_link_arguments(fuzzer_flags, language: 'cpp')
endif endif
add_global_arguments(compiler.get_supported_arguments(test_cxxflags), language: 'cpp') add_global_arguments(compiler.get_supported_arguments(test_global_cxxflags), language: 'cpp')
add_global_arguments(c_compiler.get_supported_arguments(test_cflags), language: 'c') add_global_arguments(c_compiler.get_supported_arguments(test_global_cflags), language: 'c')
add_global_link_arguments(compiler.get_supported_link_arguments(test_ldflags), language: 'cpp') add_project_arguments(compiler.get_supported_arguments(test_cxxflags), language: 'cpp')
add_project_arguments(c_compiler.get_supported_arguments(test_cflags), language: 'c')
add_project_link_arguments(compiler.get_supported_link_arguments(test_ldflags), language: 'cpp')
is_linux = host_machine.system() == 'linux' is_linux = host_machine.system() == 'linux'
is_android = get_option('android_ndk') != '' is_android = get_option('android_ndk') != ''