diff --git a/interpreter.py b/interpreter.py index b9f91c4b8..914caa10c 100644 --- a/interpreter.py +++ b/interpreter.py @@ -1269,6 +1269,11 @@ class Interpreter(): if not self.is_subproject() and 'subproject_dir' in kwargs: self.subproject_dir = kwargs['subproject_dir'] + if 'meson_version' in kwargs: + cv = coredata.version + pv = kwargs['meson_version'] + if not mesonlib.version_compare(cv, pv): + raise InterpreterException('Meson version is %s but project requires %s.' % (cv, pv)) self.build.projects[self.subproject] = args[0] mlog.log('Project name: ', mlog.bold(args[0]), sep='') self.add_languages(node, args[1:]) diff --git a/test cases/common/1 trivial/meson.build b/test cases/common/1 trivial/meson.build index 2e0426acb..3f1453996 100644 --- a/test cases/common/1 trivial/meson.build +++ b/test cases/common/1 trivial/meson.build @@ -1,5 +1,5 @@ # Comment on the first line -project('trivial test', 'c') +project('trivial test', 'c', meson_version : '>=0.27.0') #this is a comment sources = 'trivial.c' diff --git a/test cases/failing/20 version/meson.build b/test cases/failing/20 version/meson.build new file mode 100644 index 000000000..9a3a851cb --- /dev/null +++ b/test cases/failing/20 version/meson.build @@ -0,0 +1 @@ +project('version mismatch', 'c', meson_version : '>100.0.0')