findpypython vs find_package(Python ....)
在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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没有区别。
find_package(python ...)
呼叫查找名为findpypython.cmake
首先在cmake_module_path
中的模块,然后在标准的Cmake安装文件夹中(肯定会找到它)。您是否希望看到
include(findpython)
?如果是这样,那是不好的做法。一个人只能通过find_package(xyz)
加载findxyz.cmake
模块。这一直适用于Cmake 2.x。您应该使用
find_package(python ...)
,正如文档所建议的那样。 https://cmake.org/cmake.org/cmake/cmake/cmake/help/help/help/help/help/v3.12/模块/findpython.htmlThere is no difference. The
find_package(Python ...)
call looks for a module namedFindPython.cmake
first inCMAKE_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 loadFindXYZ.cmake
modules viafind_package(XYZ)
. This applies all the way back to CMake 2.x.You should use
find_package(Python ...)
, exactly as the documentation suggests. https://cmake.org/cmake/help/v3.12/module/FindPython.html