aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThibault Saunier <tsaunier@igalia.com>2019-07-12 21:54:09 -0400
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2019-07-13 05:17:01 +0000
commit6813ef1e2424cdcfc0811bb0c7b3d2efc996fd36 (patch)
tree73f264f13ead466fd050f004f7ee1fae302a0d34
parent185238fdb479e2f7007ccda47e59b65557b7ee4b (diff)
downloadmeson-6813ef1e2424cdcfc0811bb0c7b3d2efc996fd36.zip
meson-6813ef1e2424cdcfc0811bb0c7b3d2efc996fd36.tar.gz
meson-6813ef1e2424cdcfc0811bb0c7b3d2efc996fd36.tar.bz2
cmake: Handle disabling subprojects
-rw-r--r--mesonbuild/modules/cmake.py5
-rw-r--r--test cases/cmake/9 disabled subproject/meson.build5
2 files changed, 9 insertions, 1 deletions
diff --git a/mesonbuild/modules/cmake.py b/mesonbuild/modules/cmake.py
index a36d748..3a01636 100644
--- a/mesonbuild/modules/cmake.py
+++ b/mesonbuild/modules/cmake.py
@@ -274,7 +274,10 @@ class CmakeModule(ExtensionModule):
if len(args) != 1:
raise InterpreterException('Subproject takes exactly one argument')
dirname = args[0]
- return CMakeSubprojectHolder(interpreter.do_subproject(dirname, 'cmake', kwargs), dirname)
+ subp = interpreter.do_subproject(dirname, 'cmake', kwargs)
+ if not subp.held_object:
+ return subp
+ return CMakeSubprojectHolder(subp, dirname)
def initialize(*args, **kwargs):
return CmakeModule(*args, **kwargs)
diff --git a/test cases/cmake/9 disabled subproject/meson.build b/test cases/cmake/9 disabled subproject/meson.build
new file mode 100644
index 0000000..ba38410
--- /dev/null
+++ b/test cases/cmake/9 disabled subproject/meson.build
@@ -0,0 +1,5 @@
+project('cmakeSubTest', ['c', 'cpp'])
+
+cm = import('cmake')
+
+sub_pro = cm.subproject('nothinig', required: false) \ No newline at end of file