Issue
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?
Solution
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
Answered By - Alex Reinking Answer Checked By - Mildred Charles (WPSolving Admin)