aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/modules/cmake.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2022-02-28 15:46:45 -0800
committerDylan Baker <dylan@pnwbakers.com>2022-03-03 10:29:14 -0800
commit5787f816159a96d4654cef276866dfbcae7619d8 (patch)
treea28c51064bacb1d4ea3ba6261c02e047f1de626f /mesonbuild/modules/cmake.py
parent4a2058cb836242a6423870e671b6b76fa48167f3 (diff)
downloadmeson-5787f816159a96d4654cef276866dfbcae7619d8.zip
meson-5787f816159a96d4654cef276866dfbcae7619d8.tar.gz
meson-5787f816159a96d4654cef276866dfbcae7619d8.tar.bz2
interpreter: add cm_interpreter to SubprojectHolder
This is used in the cmake module, as an extra attribute we just tack on. Instead, let's actually define and type it.
Diffstat (limited to 'mesonbuild/modules/cmake.py')
-rw-r--r--mesonbuild/modules/cmake.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/mesonbuild/modules/cmake.py b/mesonbuild/modules/cmake.py
index a58ad54..0f54d30 100644
--- a/mesonbuild/modules/cmake.py
+++ b/mesonbuild/modules/cmake.py
@@ -104,9 +104,10 @@ endmacro()
class CMakeSubproject(ModuleObject):
def __init__(self, subp: SubprojectHolder):
assert isinstance(subp, SubprojectHolder)
- assert hasattr(subp, 'cm_interpreter')
+ assert subp.cm_interpreter is not None
super().__init__()
self.subp = subp
+ self.cm_interpreter = subp.cm_interpreter
self.methods.update({'get_variable': self.get_variable,
'dependency': self.dependency,
'include_directories': self.include_directories,
@@ -121,7 +122,7 @@ class CMakeSubproject(ModuleObject):
raise InterpreterException('Exactly one argument is required.')
tgt = args[0]
- res = self.subp.cm_interpreter.target_info(tgt)
+ res = self.cm_interpreter.target_info(tgt)
if res is None:
raise InterpreterException(f'The CMake target {tgt} does not exist\n' +
' Use the following command in your meson.build to list all available targets:\n\n' +
@@ -172,7 +173,7 @@ class CMakeSubproject(ModuleObject):
@noPosargs
@noKwargs
def target_list(self, state, args, kwargs):
- return self.subp.cm_interpreter.target_list()
+ return self.cm_interpreter.target_list()
@noPosargs
@noKwargs