diff --git a/mesonbuild/build.py b/mesonbuild/build.py index d389f034a..c0174253a 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -26,7 +26,6 @@ import re import textwrap import typing as T - from . import environment from . import dependencies from . import mlog @@ -2665,8 +2664,16 @@ class CompileTarget(BuildTarget): output_templ: str, compiler: Compiler, backend: Backend, - kwargs): + compile_args: T.List[str], + include_directories: T.List[IncludeDirs], + dependencies: T.List[dependencies.Dependency]): compilers = {compiler.get_language(): compiler} + kwargs = { + 'build_by_default': False, + f'{compiler.language}_args': compile_args, + 'include_directories': include_directories, + 'dependencies': dependencies, + } super().__init__(name, subdir, subproject, compiler.for_machine, sources, None, [], environment, compilers, kwargs) self.filename = name diff --git a/mesonbuild/interpreter/compiler.py b/mesonbuild/interpreter/compiler.py index 70bfd311a..da50d7bb0 100644 --- a/mesonbuild/interpreter/compiler.py +++ b/mesonbuild/interpreter/compiler.py @@ -773,12 +773,6 @@ class CompilerHolder(ObjectHolder['Compiler']): if any(isinstance(s, (build.CustomTarget, build.CustomTargetIndex, build.GeneratedList)) for s in sources): FeatureNew.single_use('compiler.preprocess with generated sources', '1.1.0', self.subproject, location=self.current_node) - tg_kwargs = { - f'{self.compiler.language}_args': kwargs['compile_args'], - 'build_by_default': False, - 'include_directories': kwargs['include_directories'], - 'dependencies': kwargs['dependencies'], - } tg_name = f'preprocessor_{next(self.preprocess_uid)}' tg = build.CompileTarget( tg_name, @@ -789,7 +783,9 @@ class CompilerHolder(ObjectHolder['Compiler']): kwargs['output'], compiler, self.interpreter.backend, - tg_kwargs) + kwargs['compile_args'], + kwargs['include_directories'], + kwargs['dependencies']) self.interpreter.add_target(tg.name, tg) # Expose this target as list of its outputs, so user can pass them to # other targets, list outputs, etc.