在cmake脚本中提供帮助信息

Supply help info in cmake script

本文关键字:帮助 信息 cmake 脚本      更新时间:2023-10-16

我希望能够在cmake脚本中为最终用户提供有关构建的帮助信息(如构建标志等)。类似的东西

cmake -G "Visual Studio 2010 Win64" projectpath --help
Configures the Foo project.
Sytnax:
cmake -G "Visual Studio 2010 Win64" projectpath --help [options]
where options are
-DNOTEST=1 disables test code
(ect)

有什么现成的方法可以做到这一点吗?

定义选项或缓存变量时,有一个参数指定帮助字符串。用户看到该帮助字符串取决于他们运行cmake的方式。在GUI中,初始配置后会显示选项,用户可以将鼠标悬停在帮助文本上查看帮助文本。在命令行中,运行cmake一次后,命令cmake-LH将显示带有帮助文本的变量。参见:

  • 选项命令文档
  • 设置命令文档