Skip to content

Commit 6bf55bf

Browse files
committed
cmake: Do not pass install prefix explicitly to the CMake interpreter
There is no point in doing so as it can be readily obtained from the environment. This in preparation of extracting more installation location from the environment.
1 parent 1e7f6f0 commit 6bf55bf

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

mesonbuild/cmake/interpreter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -786,12 +786,12 @@ def log(self) -> None:
786786
mlog.log(' -- depends: ', mlog.bold(str(self.depends)))
787787

788788
class CMakeInterpreter:
789-
def __init__(self, subdir: Path, install_prefix: Path, env: 'Environment', backend: 'Backend'):
789+
def __init__(self, subdir: Path, env: 'Environment', backend: 'Backend'):
790790
self.subdir = subdir
791791
self.src_dir = Path(env.get_source_dir(), subdir)
792792
self.build_dir_rel = subdir / '__CMake_build'
793793
self.build_dir = Path(env.get_build_dir()) / self.build_dir_rel
794-
self.install_prefix = install_prefix
794+
self.install_prefix = Path(T.cast('str', env.coredata.optstore.get_value_for(OptionKey('prefix'))))
795795
self.env = env
796796
self.for_machine = MachineChoice.HOST # TODO make parameter
797797
self.backend_name = backend.name

mesonbuild/interpreter/interpreter.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,12 +1049,10 @@ def _do_subproject_cmake(self, subp_name: str, subdir: str,
10491049
kwargs: kwtypes.DoSubproject) -> SubprojectHolder:
10501050
from ..cmake import CMakeInterpreter
10511051
with mlog.nested(subp_name):
1052-
prefix = self.coredata.optstore.get_value_for('prefix')
1053-
10541052
from ..modules.cmake import CMakeSubprojectOptions
10551053
kw_opts = kwargs.get('options') or CMakeSubprojectOptions()
10561054
cmake_options = kwargs.get('cmake_options', []) + kw_opts.cmake_options
1057-
cm_int = CMakeInterpreter(Path(subdir), Path(prefix), self.build.environment, self.backend)
1055+
cm_int = CMakeInterpreter(Path(subdir), self.build.environment, self.backend)
10581056
cm_int.initialise(cmake_options)
10591057
cm_int.analyse()
10601058

0 commit comments

Comments
 (0)