[BUG]: Cannot overwrite PYTHON_MODULE_EXTENSION when FindPython3.cmake is used #4854
Closed
3 tasks done
Labels
triage
New bug, unverified
Required prerequisites
What version (or hash if on master) of pybind11 are you using?
v2.11.1
Problem description
I'm trying to migrate our project from old FindPythonInterp and FindPythonLibs cmake modules to new FindPython3.
We are using cross-compilation in our project to compile ARM64 C++ and Python binaries.
In order to have a proper python extension for compiled modules, I used
PYTHON_MODULE_EXTENSION
. But with migration to new cmake python modules, it triggers different code path inside pybind11. In fact,PYTHON_MODULE_EXTENSION
ignores my value set via cmake cmd.This because of first run, pybind11 checks:
pybind11/tools/pybind11NewTools.cmake
Lines 76 to 83 in 5891867
While
PYBIND11_PYTHON_EXECUTABLE_LAST
is empty and unsets user-specified value forPYTHON_MODULE_EXTENSION
. And later it setsPYTHON_MODULE_EXTENSION
which results in build platform prefix:pybind11/tools/pybind11NewTools.cmake
Lines 98 to 128 in 5891867
pybind11 has a cmake option
PYBIND11_PYTHONLIBS_OVERWRITE
, maybe we need to introduce something for FindPython3.cmake case? Or completely remove such under for the first cmake iteration.Reproducible example code
Is this a regression? Put the last known working version here if it is.
Not a regression
The text was updated successfully, but these errors were encountered: