doc/meson.build: convert option "documentation" to Meson "feature"

This allows automatic optional detection of Sphinx.  This will be
useful when we start building the manpages with Sphinx, which many
users may want to have.
This commit is contained in:
Max Kellermann 2020-08-14 12:35:29 +02:00
parent 2bcd8516ea
commit 2e73e605f7
3 changed files with 7 additions and 5 deletions

View File

@ -1,6 +1,10 @@
install_man(['mpd.1', 'mpd.conf.5']) install_man(['mpd.1', 'mpd.conf.5'])
sphinx = find_program('sphinx-build') sphinx = find_program('sphinx-build', required: get_option('documentation'))
if not sphinx.found()
subdir_done()
endif
sphinx_output = custom_target( sphinx_output = custom_target(
'HTML documentation', 'HTML documentation',
output: 'html', output: 'html',

View File

@ -543,9 +543,7 @@ install_data(
install_dir: join_paths(get_option('datadir'), 'doc', meson.project_name()), install_dir: join_paths(get_option('datadir'), 'doc', meson.project_name()),
) )
if get_option('documentation') subdir('doc')
subdir('doc')
endif
if get_option('test') if get_option('test')
subdir('test') subdir('test')

View File

@ -1,4 +1,4 @@
option('documentation', type: 'boolean', value: false, description: 'Build documentation') option('documentation', type: 'feature', description: 'Build documentation')
option('test', type: 'boolean', value: false, description: 'Build the unit tests and debug programs') option('test', type: 'boolean', value: false, description: 'Build the unit tests and debug programs')