summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErwin Jansen <pokowaka@gmail.com>2023-11-28 12:48:49 -0800
committerJussi Pakkanen <jpakkane@gmail.com>2023-12-07 11:59:40 +0200
commit5de09cbe8838e8febf1ca3aa83b53cf06972bff3 (patch)
tree66da11f487e1c9518235aea3feb3c02e6a0d037f
parent254abb999fae0e29a20200472f016f2cd7236aef (diff)
downloadmeson-5de09cbe8838e8febf1ca3aa83b53cf06972bff3.tar.gz
Always use posix paths when retrieving link name
This commit modifies the get_target_filename_for_linking function to always return POSIX-style paths, even on Windows systems. This is necessary because the Ninja generator can have issues with Windows-style paths when using the `/WHOLEARCHIVE:` flag. This is consistent with the syntax accepted by the cl and clang-cl compilers, as documented in the Microsoft documentation: https: //learn.microsoft.com/en-us/cpp/build/reference/cl-filename-syntax?view=msvc-170 Fixes: 12534
-rw-r--r--mesonbuild/backend/backends.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
index 639e07b2a..f60c884fb 100644
--- a/mesonbuild/backend/backends.py
+++ b/mesonbuild/backend/backends.py
@@ -358,16 +358,16 @@ class Backend:
# In AIX, if we archive .so, the blibpath must link to archived shared library otherwise to the .so file.
if mesonlib.is_aix() and target.aix_so_archive:
link_lib = re.sub('[.][a]([.]?([0-9]+))*([.]?([a-z]+))*', '.a', link_lib.replace('.so', '.a'))
- return os.path.join(self.get_target_dir(target), link_lib)
+ return Path(self.get_target_dir(target), link_lib).as_posix()
elif isinstance(target, build.StaticLibrary):
- return os.path.join(self.get_target_dir(target), target.get_filename())
+ return Path(self.get_target_dir(target), target.get_filename()).as_posix()
elif isinstance(target, (build.CustomTarget, build.CustomTargetIndex)):
if not target.is_linkable_target():
raise MesonException(f'Tried to link against custom target "{target.name}", which is not linkable.')
- return os.path.join(self.get_target_dir(target), target.get_filename())
+ return Path(self.get_target_dir(target), target.get_filename()).as_posix()
elif isinstance(target, build.Executable):
if target.import_filename:
- return os.path.join(self.get_target_dir(target), target.get_import_filename())
+ return Path(self.get_target_dir(target), target.get_import_filename()).as_posix()
else:
return None
raise AssertionError(f'BUG: Tried to link to {target!r} which is not linkable')