无法在C ++项目上从Meson运行Doxygen

时间:2018-09-26 14:29:45

标签: c++ configuration doxygen meson-build

我无法通过Meson的配置运行Doxygen。

这是meson.build中的相关代码:

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

成功找到doxygen可执行文件:

  

找到程序doxygen:是(/ usr / bin / doxygen)

但是,当启动时,我收到此错误消息:

  

[0/1]运行外部命令文档。
  无法执行命令“ doxygen / home / project / Doxyfile”。找不到文件。
  失败:介子文档

从命令行手动运行它即可:

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

我的meson.build配置有什么问题?

1 个答案:

答案 0 :(得分:4)

根据参考文献manual

  

命令是一个列表,其中包含要运行的命令和参数   传递给它。每个列表项可以是一个字符串或一个目标

因此,在您的情况下,介子将整个字符串视为命令,即工具名称,而不是命令+参数。因此,请尝试以下操作:

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

或者直接使用 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

请注意,如果要在Doxyfile.in的支持下改善文档生成,请查看custom_target(),并以this之类的示例查看。