【问题标题】:Cannot run Doxygen from Meson on a C++ project无法在 C++ 项目中从 Meson 运行 Doxygen
【发布时间】:2018-09-26 14:29:44
【问题描述】:

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

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

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

成功找到doxygen可执行文件:

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

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

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

从命令行手动运行它可以工作:

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

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

【问题讨论】:

  • 我不知道介子。但是当你在介子构建中使用时会发生什么:run_target('docs', command : 'where doxygen ')
  • @albert - 我得到:Could not execute command "where doxygen ". File not found.FAILED: meson-docs
  • @albert - 但是,如果我通过 bash 运行 where doxygen,我会得到:where: command not found
  • 对不起,命令应该是which 而不是where(混合了两个操作系统)
  • 相同结果:Could not execute command "which doxygen ". File not found.。但现在它可以从命令行运行。

标签: c++ configuration doxygen meson-build


【解决方案1】:

根据参考manual

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

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

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 之类的示例。

【讨论】:

  • 单词 list 的突出显示确实很好地说明了它以及您提供的示例。
猜你喜欢
  • 1970-01-01
  • 2014-12-27
  • 1970-01-01
  • 1970-01-01
  • 2014-01-11
  • 1970-01-01
  • 2020-09-21
  • 2018-08-19
  • 1970-01-01
相关资源
最近更新 更多