backend: Add rpath for external versioned .so's

On Linux many .so's are augmented with version information,
e.g. libxyz.so.1.2.3. CMake will happily refer to these versioned .so's
in its dependencies instead of libxyz.so (typically a symlink).
Unfortunately these versioned .so's aren't recognized as libraries by
the Backend's logic to produce build rpaths from library paths.

Fix this by recognizing any .so extension as sufficient reason to
produce a build rpath, not just if .so is the last extension.
pull/12637/head
Jonathon Anderson 1 year ago committed by Dylan Baker
parent 57b7fbb29d
commit 76ad5fe8d3
  1. 6
      mesonbuild/backend/backends.py

@ -780,7 +780,11 @@ class Backend:
# Windows doesn't support rpaths, but we use this function to
# emulate rpaths by setting PATH
# .dll is there for mingw gcc
if os.path.splitext(libpath)[1] not in {'.dll', '.lib', '.so', '.dylib'}:
# .so's may be extended with version information, e.g. libxyz.so.1.2.3
if not (
os.path.splitext(libpath)[1] in {'.dll', '.lib', '.so', '.dylib'}
or re.match(r'.+\.so(\.|$)', os.path.basename(libpath))
):
continue
try:

Loading…
Cancel
Save