Xcode 15, which provides the compiler toolchain for building libvirt
on macOS has switched to a new linker that warns about duplicated
"-lblah" options on the ld commandline. In practice this is impossible
to prevent in a large project, and also harmless.
Fortunately the new ld command also has an option,
-no_warn_duplicate_libraries, that supresses this harmless/pointless
warning, meson has a simple way to check if that option is supported,
and libvirt's meson.build files already have examples of adding an
option to the ld commandline if it's available.
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
'-Wl,--no-copy-dt-needed-entries',
])
+libvirt_no_warn_duplicate_libraries = cc.get_supported_link_arguments([
+ '-Wl,-no_warn_duplicate_libraries',
+])
+
if host_machine.system() == 'windows'
version_script_flags = '-Wl,'
elif host_machine.system() == 'darwin'
link_args: (
libvirt_relro
+ libvirt_no_indirect
+ + libvirt_no_warn_duplicate_libraries
+ coverage_flags
+ driver_modules_flags
+ win32_link_flags
],
link_args: (
libvirt_export_dynamic
+ + libvirt_no_warn_duplicate_libraries
+ libvirt_flat_namespace
+ coverage_flags
),
libvirt_relro
+ libvirt_no_indirect
+ libvirt_no_undefined
+ + libvirt_no_warn_duplicate_libraries
),
)