[BE][CMake] Use FindPython module (#124613)

As FindPythonInterp and FindPythonLibs has been deprecated since cmake-3.12

Replace `PYTHON_EXECUTABLE` with `Python_EXECUTABLE` everywhere (CMake variable names are case-sensitive)

This makes PyTorch buildable with python3 binary shipped with XCode on MacOS

TODO: Get rid of `FindNumpy` as its part of Python package
Pull Request resolved: https://github.com/pytorch/pytorch/pull/124613
Approved by: https://github.com/cyyever, https://github.com/Skylion007
This commit is contained in:
Nikita Shulga
2024-05-29 13:17:35 +00:00
committed by PyTorch MergeBot
parent 942d9abd66
commit 0910429d72
16 changed files with 53 additions and 93 deletions

View File

@ -17,8 +17,7 @@ import sys
import sysconfig
flags = [
f"-DPYTHON_EXECUTABLE:FILEPATH={sys.executable}",
f"-DPYTHON_INCLUDE_DIR={sysconfig.get_path('include')}",
f"-DPython_EXECUTABLE:FILEPATH={sys.executable}",
]
print(" ".join(flags), end="")