在`findxxx.cmake`中读取CMAKE软件包描述的正确方法是什么?

发布于 2025-02-12 22:25:33 字数 1202 浏览 1 评论 0 原文

当用不熟悉的软件包对抗时,我需要阅读 findxxx.cmake 以找出预定义的缓存变量。例如,在 findboost.cmake 中,起始行是这样的:

# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.

#[=======================================================================[.rst:
FindBoost
---------

Find Boost include dirs and libraries

Use this module by invoking :command:`find_package` with the form:

.. code-block:: cmake

  find_package(Boost
    [version] [EXACT]      # Minimum or EXACT version e.g. 1.67.0
    [REQUIRED]             # Fail with error if Boost is not found
    [COMPONENTS <libs>...] # Boost libraries by their canonical name
                           # e.g. "date_time" for "libboost_date_time"
    [OPTIONAL_COMPONENTS <libs>...]
                           # Optional Boost libraries by their canonical name)
    )                      # e.g. "date_time" for "libboost_date_time"

描述是用 .rst 编写的,但是我不知道读取它的正确方法是什么除了使用VIM打开它。

我理想的阅读方式是使用命令行,例如 cmake-show-show-module boost ,然后弹出了一个观众。或使用vscode,悬停 find_package(boost),然后弹出描述。我该如何实现?

When countered with unfamiliar packages, I need to read the Findxxx.cmake to figure out the pre-defined cached variable. For example, in FindBoost.cmake, the starting lines are like this:

# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.

#[=======================================================================[.rst:
FindBoost
---------

Find Boost include dirs and libraries

Use this module by invoking :command:`find_package` with the form:

.. code-block:: cmake

  find_package(Boost
    [version] [EXACT]      # Minimum or EXACT version e.g. 1.67.0
    [REQUIRED]             # Fail with error if Boost is not found
    [COMPONENTS <libs>...] # Boost libraries by their canonical name
                           # e.g. "date_time" for "libboost_date_time"
    [OPTIONAL_COMPONENTS <libs>...]
                           # Optional Boost libraries by their canonical name)
    )                      # e.g. "date_time" for "libboost_date_time"

The description is written in .rst, but I don't know what's the right way to read it except for open it using vim.

My ideal way to read is using command line like cmake-show-module boost, then a viewer pops out. Or using vscode, hovering find_package(BOOST), then the description pops out. How can I achieve it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

深爱成瘾 2025-02-19 22:25:33

Cmake的查找&lt; module&gt; 文件以重组文本(RST)格式包含其文档。 Findboost 模块地址 https://cmake.org/cmake/help/latest/module/findboost.html

要从命令行中查看文档,您可以

cmake --help-module FindBoost

用于其他cmake查找模块替换 boost 用适当的模块名称,例如 qt

CMake's Find<module> files contain their documentation in reStructuredText (rst) format. The online documentation is generated from this data and can be easily viewed with a browser, e.g. using for the FindBoost module the address https://cmake.org/cmake/help/latest/module/FindBoost.html.

To view the documentation from the command line you can use

cmake --help-module FindBoost

For other CMake find modules replace Boost with the appropriate module name, for instance Qt.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文