findpypython vs find_package(Python ....)

发布于 2025-02-09 04:51:02 字数 282 浏览 2 评论 0原文

在cmake 3.12中介绍以帮助找到Python的口译员和其他组件。

但是,我继续使用find_package(Python ...)看到许多示例。

如果我可以保证我使用Cmake 3.12,我应该使用哪个?两者之间的关系是什么?

In CMake 3.12 the FindPython module was introduced to help find the Python interpreter and other components.

However, I continue to see many examples using find_package(Python ...).

Which should I use if I can guarantee I'm using CMake 3.12? What is the relationship between the two?

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

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

发布评论

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

评论(1

走过海棠暮 2025-02-16 04:51:02

没有区别。 find_package(python ...)呼叫查找名为findpypython.cmake首先在cmake_module_path中的模块,然后在标准的Cmake安装文件夹中(肯定会找到它)。

您是否希望看到include(findpython)?如果是这样,那是不好的做法。一个人只能通过find_package(xyz)加载findxyz.cmake模块。这一直适用于Cmake 2.x。

如果我可以保证我使用cmake 3.12?

,我应该使用哪个

您应该使用find_package(python ...),正如文档所建议的那样。 https://cmake.org/cmake.org/cmake/cmake/cmake/help/help/help/help/help/v3.12/模块/findpython.html

There is no difference. The find_package(Python ...) call looks for a module named FindPython.cmake first in CMAKE_MODULE_PATH, then in the standard CMake installation folder (where it will be found for sure).

Are you expecting to see include(FindPython)? If so, that's bad practice. One should only load FindXYZ.cmake modules via find_package(XYZ). This applies all the way back to CMake 2.x.

Which should I use if I can guarantee I'm using CMake 3.12?

You should use find_package(Python ...), exactly as the documentation suggests. https://cmake.org/cmake/help/v3.12/module/FindPython.html

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