diff options
author | Simon Ser <contact@emersion.fr> | 2020-11-15 19:32:46 +0100 |
---|---|---|
committer | Harry Jeffery <harry@exec64.co.uk> | 2020-11-16 22:01:46 +0000 |
commit | cb7b5fcd5d16bd1e71a9529c4366a4a3de5b2fb0 (patch) | |
tree | 2750eaed55395d4f8a88972307364f38954f72ed /meson.build | |
parent | 0131ab6f97a6ea82d3c87c7b59646dcf9a8d68fa (diff) | |
download | imv-cb7b5fcd5d16bd1e71a9529c4366a4a3de5b2fb0.tar.gz |
Make tests and man pages optional
Allows to build imv without these extra features.
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 72 |
1 files changed, 38 insertions, 34 deletions
diff --git a/meson.build b/meson.build index 6a48cbf..672ba1a 100644 --- a/meson.build +++ b/meson.build @@ -169,45 +169,49 @@ install_data( install_mode: 'rw-r--r--', ) -dep_cmocka = dependency('cmocka') +dep_cmocka = dependency('cmocka', required: get_option('test')) -foreach test : ['list', 'navigator'] - test( - 'test_@0@'.format(test), - executable( +if dep_cmocka.found() + foreach test : ['list', 'navigator'] + test( 'test_@0@'.format(test), - [files('test/@0@.c'.format(test), 'src/dummy_window.c'), files_common], - include_directories: include_directories('src'), - dependencies: [deps_for_imv, dep_cmocka], + executable( + 'test_@0@'.format(test), + [files('test/@0@.c'.format(test), 'src/dummy_window.c'), files_common], + include_directories: include_directories('src'), + dependencies: [deps_for_imv, dep_cmocka], + ) ) - ) -endforeach + endforeach +endif -prog_a2x = find_program('a2x') +prog_a2x = find_program('a2x', required: get_option('man')) -foreach man : [ - [1, 'imv'], - [1, 'imv-msg'], - [5, 'imv'], -] - _section = man[0] - _topic = man[1] - custom_target( - '@0@(@1@)'.format(_topic, _section), - input: 'doc/@0@.@1@.txt'.format(_topic, _section), - output: '@0@.@1@'.format(_topic, _section), - command: [ - prog_a2x, - '--no-xmllint', - '--doctype', 'manpage', - '--format', 'manpage', - '--destination-dir', meson.current_build_dir(), - '@INPUT@' - ], - install: true, - install_dir: '@0@/man@1@'.format(get_option('mandir'), _section) - ) -endforeach +if prog_a2x.found() + foreach man : [ + [1, 'imv'], + [1, 'imv-msg'], + [5, 'imv'], + ] + _section = man[0] + _topic = man[1] + custom_target( + '@0@(@1@)'.format(_topic, _section), + input: 'doc/@0@.@1@.txt'.format(_topic, _section), + output: '@0@.@1@'.format(_topic, _section), + command: [ + prog_a2x, + '--no-xmllint', + '--doctype', 'manpage', + '--format', 'manpage', + '--destination-dir', meson.current_build_dir(), + '@INPUT@' + ], + install: true, + install_dir: '@0@/man@1@'.format(get_option('mandir'), _section) + ) + endforeach +endif message('\n\n' + 'Building imv @0@\n\n'.format(meson.project_version()) |