Skip to content

Commit

Permalink
cmake: filter and order clib_compiler languages
Browse files Browse the repository at this point in the history
  • Loading branch information
Akaricchi committed Oct 9, 2024
1 parent 35dc1ec commit 6f61d48
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions mesonbuild/cmake/interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,6 @@ def __init__(self, target: CMakeTarget, env: 'Environment', for_machine: Machine

self.generated_raw: T.List[Path] = []

self.clib_compiler = None

for i in target.files:
languages: T.Set[str] = set()
src_suffixes: T.Set[str] = set()
Expand All @@ -277,10 +275,6 @@ def __init__(self, target: CMakeTarget, env: 'Environment', for_machine: Machine
# Register the new languages and initialize the compile opts array
for lang in languages:
self.languages.add(lang)

if self.clib_compiler is None:
self.clib_compiler = self.env.coredata.compilers[self.for_machine].get(lang)

if lang not in self.compile_opts:
self.compile_opts[lang] = []

Expand All @@ -300,6 +294,17 @@ def __init__(self, target: CMakeTarget, env: 'Environment', for_machine: Machine
else:
self.sources += i.sources

self.clib_compiler = None
compilers = self.env.coredata.compilers[self.for_machine]

for lang in ['objcpp', 'cpp', 'objc', 'fortran', 'c']:
if lang in self.languages:
try:
self.clib_compiler = compilers[lang]
break
except KeyError:
pass

def __repr__(self) -> str:
return f'<{self.__class__.__name__}: {self.name}>'

Expand Down

0 comments on commit 6f61d48

Please sign in to comment.