aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/templates/dlangtemplates.py
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild/templates/dlangtemplates.py')
-rw-r--r--mesonbuild/templates/dlangtemplates.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/mesonbuild/templates/dlangtemplates.py b/mesonbuild/templates/dlangtemplates.py
index a3703a8..124634c 100644
--- a/mesonbuild/templates/dlangtemplates.py
+++ b/mesonbuild/templates/dlangtemplates.py
@@ -88,13 +88,15 @@ test('{test_name}', test_exe)
# Make this library usable from the Dlang
# build system.
dlang_mod = import('dlang')
-dlang_mod.generate_dub_file(meson.project_name().to_lower(), meson.source_root(),
- name : meson.project_name(),
- license: meson.project_license(),
- sourceFiles : '{source_file}',
- description : 'Meson sample project.',
- version : '{version}',
-)
+if find_program('dub', required: false).found()
+ dlang_mod.generate_dub_file(meson.project_name().to_lower(), meson.source_root(),
+ name : meson.project_name(),
+ license: meson.project_license(),
+ sourceFiles : '{source_file}',
+ description : 'Meson sample project.',
+ version : '{version}',
+ )
+endif
'''
def create_exe_d_sample(project_name, project_version):