diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index ce5565f5c..cc601d8b2 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -2467,7 +2467,9 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485''')) # Add linker args for linking this target derived from 'base' build # options passed on the command-line, in default_options, etc. # These have the lowest priority. - if not isinstance(target, build.StaticLibrary): + if isinstance(target, build.StaticLibrary): + commands += linker.get_base_link_args(self.get_base_options_for_target(target)) + else: commands += compilers.get_base_link_args(self.get_base_options_for_target(target), linker, isinstance(target, build.SharedModule)) diff --git a/mesonbuild/linkers.py b/mesonbuild/linkers.py index 20b513a2e..9529cb739 100644 --- a/mesonbuild/linkers.py +++ b/mesonbuild/linkers.py @@ -33,6 +33,10 @@ class StaticLinker: """ return mesonlib.is_windows() + def get_base_link_args(self, options: 'OptionDictType') -> typing.List[str]: + """Like compilers.get_base_link_args, but for the static linker.""" + return [] + def get_exelist(self) -> typing.List[str]: return self.exelist.copy()