Pietro
Pietro

Reputation: 13182

Cannot run Doxygen from Meson on a C++ project

I cannot run Doxygen through Meson's configuration.

This is the related code in meson.build:

doxygen = find_program('doxygen')
...
run_target('docs', command : 'doxygen ' + meson.source_root() + '/Doxyfile')

The doxygen executable is successfully found:

Program doxygen found: YES (/usr/bin/doxygen)

However, when launched, I get this error message:

[0/1] Running external command docs.
Could not execute command "doxygen /home/project/Doxyfile". File not found.
FAILED: meson-docs

Running it manually from the command line it works:

/usr/bin/doxygen /home/project/Doxyfile
doxygen /home/project/Doxyfile

What is wrong in my meson.build configuration?

Upvotes: 4

Views: 2204

Answers (1)

pmod
pmod

Reputation: 11007

According to reference manual,

command is a list containing the command to run and the arguments to pass to it. Each list item may be a string or a target

So, in your case the whole string is treated by meson as command, i.e. tool name, not as command + arguments. So, try this:

run_target('docs', command : ['doxygen', meson.source_root() + '/Doxyfile'])

Or it could be better to use directly the result of find_program():

doxygen = find_program('doxygen', required : false)
if doxygen.found()
  message('Doxygen found')
  run_target('docs', command : [doxygen, meson.source_root() + '/Doxyfile'])    
else
  warning('Documentation disabled without doxygen')
endif

Note that if you want to improve docs generation with support of Doxyfile.in, take a look at custom_target() instead and example like this.

Upvotes: 7

Related Questions