使用 cmake 生成手册页/打包/安装
我正在寻找一些关于如何使用 CMake 在项目中生成、打包和安装手册页的好示例/教程。
I am looking for some good examples / tutorials on how to generate, package, and install man pages in projects using CMake.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
对于 Linux 下的 cmake 2.8.12,以下内容对我有用:
即使按照 CMake 标准,它看起来也不优雅。我希望看到一个更少口吃的解决方案。
With cmake 2.8.12 under Linux, the following works for me:
Which looks unelegant even by CMake standards. I would like to see a solution with less stammering.
也许您会对以下解决方案感兴趣,它允许生成和安装用 Markdown 或 AsciiDoc 编写的手册页:
https://github.com/rnpgp/cmake-modules/
要生成并安装用 Markdown 编写的手册页,只需在
CMakeLists.txt 中添加两行:
与 AsciiDoc 和 AsciiDoctor 相同:
Maybe you would be interested in the following solution, which allows to generate and install man pages, written in Markdown or AsciiDoc:
https://github.com/rnpgp/cmake-modules/
To generate and install man page, written in Markdown, it would be as easy as add two lines to your
CMakeLists.txt
:The same with AsciiDoc and AsciiDoctor:
这是一个非常简单的解决方案,适用于 deb 和 rpm 软件包:
install(FILES manfile.1 TYPE MAN)
可以在此处找到官方文档:
https://cmake.org/cmake/help/latest/command/ install.html#install
查找大小写匹配的单词 TYPE。
Here is a very simple solution, that works well with both deb and rpm packages:
install(FILES manfile.1 TYPE MAN)
Official documentation can be found here:
https://cmake.org/cmake/help/latest/command/install.html#install
Look for word TYPE with match case.
您可以深入研究 CMake 本身的源代码树,了解它如何安装自己的手册页。
它肯定是以下组合:
有关详细信息,请参阅 CMake 的 add_custom_command 和安装命令的文档:
You can delve into the source tree of CMake itself to see how it installs its own man pages.
It is sure to be a combination of:
See the documentation for CMake's add_custom_command and install commands for more information: