[meson] fix spurious warning when building test/api C sources
Fixes compiler warning
test-unicode.c:589:1: warning: ‘test_unicode_properties_lenient’ defined but not used
which didn't happen with autotools.
Reason it does with meson is that the setup for C was slightly wrong.
We would only add -DHAVE_CONFIG_H to cpp_args which is only valid when
compiling C++ code, but not plain C code, and many of these tests were
plain C.
Instead pass -DHAVE_CONFIG_H via add_project_arguments() and make sure
to set both c_args and cpp_args when building test executables.
Fixes https://github.com/harfbuzz/harfbuzz/issues/2257
diff --git a/meson.build b/meson.build
index c22e926..52e829a 100644
--- a/meson.build
+++ b/meson.build
@@ -144,13 +144,14 @@
conf = configuration_data()
incconfig = include_directories('.')
-cpp_args = ['-DHAVE_CONFIG_H']
+
+add_project_arguments('-DHAVE_CONFIG_H', language: ['c', 'cpp'])
warn_cflags = [
'-Wno-non-virtual-dtor',
]
-cpp_args += cpp.get_supported_arguments(warn_cflags)
+cpp_args = cpp.get_supported_arguments(warn_cflags)
if m_dep.found()
deps += [m_dep]