Use C++ linker when building with libicu

ICU is a C++ library, event though it has C interface.
Therefore we have to use C++ linker when linking with it.
This commit is contained in:
Alexey Rochev 2022-01-07 00:58:02 +03:00
parent 88a75d4711
commit 02c8476071
5 changed files with 12 additions and 1 deletions

View File

@ -19,6 +19,7 @@ foreach test_case : ['fuzzer', 'load_fuzzer', 'load_dafsa_fuzzer']
c_args : fuzzer_cargs,
include_directories : [configinc, includedir],
dependencies : libicu_dep,
link_language : link_language
)
test(test_name, exe)
endforeach

View File

@ -19,6 +19,8 @@ libunistring = notfound
networking_deps = notfound
libiconv_dep = notfound
link_language = 'c'
# FIXME: Cleanup this when Meson gets 'feature-combo':
# https://github.com/mesonbuild/meson/issues/4566
# Dependency fallbacks would help too:
@ -59,6 +61,11 @@ if ['libicu', 'auto'].contains(enable_runtime) or ['libicu', 'auto'].contains(en
if enable_builtin == 'auto'
enable_builtin = 'libicu'
endif
if add_languages('cpp', native : false)
link_language = 'cpp'
else
error('C++ compiler is not available')
endif
elif [enable_runtime, enable_builtin].contains('libicu')
error('You requested libicu but it is not installed.')
endif

View File

@ -29,6 +29,7 @@ libpsl = library('psl', sources, suffixes_dafsa_h,
dependencies : [libidn2_dep, libidn_dep, libicu_dep, libunistring, networking_deps, libiconv_dep],
version: library_version,
install: true,
link_language : link_language
)
pkgconfig.generate(libpsl,

View File

@ -32,6 +32,7 @@ foreach test_name : tests
exe = executable(test_name, source,
c_args : tests_cargs,
link_with : libpsl,
include_directories : [configinc, includedir])
include_directories : [configinc, includedir],
link_language : link_language)
test(test_name, exe, depends : [psl_dafsa, psl_ascii_dafsa])
endforeach

View File

@ -2,6 +2,7 @@ psl = executable('psl', 'psl.c',
link_with : libpsl,
include_directories : [configinc, includedir],
c_args : ['-DHAVE_CONFIG_H'],
link_language : link_language,
install : true,
)