cmake: use correct build directory in CMakeInterpreter

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini authored and Paolo Bonzini committed 2026-10-30 19:32:29 +01:00
1 parent faa6a938b3
commit 18d883118f
3 files changed
+8 -5

No files matched your search

+1
View File
@@ -485,6 +485,7 @@ class BuildProject:
@lazy_property
def prefix(self) -> str:
# This must be the same as CMakeInterpreter.__init__
return 'build.' if self.for_machine is MachineChoice.BUILD else ''
@lazy_property
+6 -4
View File
@@ -795,10 +795,12 @@ class ConverterCustomTarget:
mlog.log(' -- depends: ', mlog.bold(str(self.depends)))
class CMakeInterpreter:
def __init__(self, subdir: Path, env: 'Environment', backend: 'Backend', for_machine: MachineChoice):
self.subdir = subdir
self.src_dir = Path(env.get_source_dir(), subdir)
self.build_dir_rel = subdir / '__CMake_build'
def __init__(self, subdir: str, env: 'Environment', backend: 'Backend', for_machine: MachineChoice):
self.subdir = Path(subdir)
# This must be the same as BuildProject.prefix
prefix = 'build.' if for_machine is MachineChoice.BUILD else ''
self.build_dir_rel = Path(prefix + subdir) / '__CMake_build'
self.src_dir = Path(env.get_source_dir()) / subdir
self.build_dir = Path(env.get_build_dir()) / self.build_dir_rel
self.install_prefix = Path(T.cast('str', env.coredata.optstore.get_value_for(OptionKey('prefix'))))
self.env = env
+1 -1
View File
@@ -1101,7 +1101,7 @@ class Interpreter(InterpreterBase, HoldableObject):
from ..modules.cmake import CMakeSubprojectOptions
kw_opts = kwargs.get('options') or CMakeSubprojectOptions()
cmake_options = kwargs.get('cmake_options', []) + kw_opts.cmake_options
cm_int = CMakeInterpreter(Path(subdir), self.build.environment, self.backend, for_machine)
cm_int = CMakeInterpreter(subdir, self.build.environment, self.backend, for_machine)
cm_int.initialise(cmake_options)
cm_int.analyse()