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

4

我无法通过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] 运行外部命令docs。
无法执行命令“doxygen /home/project/Doxyfile”。文件未找到。
FAILED: meson-docs

但是,手动从命令行运行它可以正常工作:

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

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

@albert - 我得到了以下错误信息:无法执行命令"where doxygen"。文件未找到。 失败:meson-docs - Pietro
@albert - 然而,如果我通过bash运行where doxygen,我会得到:where: command not found - Pietro
抱歉,命令应该是“which”,而不是“where”(混淆了两个操作系统)。 - albert
Could not execute command "ls -ls ". File not found. - Pietro
一些适用于介子专家的东西... - albert
显示剩余8条评论
1个回答

7
根据参考手册

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

因此,在您的情况下,整个字符串被meson视为命令,即工具名称,而不是命令+参数。因此,请尝试这样做:
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的示例。

1
把单词“list”标亮确实让它更加引人注目,而你给出的例子也很好。 - albert

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接