FindPython: Specify the SOABI when cross compiling
When cross-compiling (currently I'm trying to support Windows ARM), FindPython doesn't support setting the SOABI as an input value. The other aspects of cross compiling work normally, but the SOABI comes out wrong, and it's a pain to do this by hacking sysconfig so Python lies about the value when asked (which is what I'm working on now). It would be really nice to have some way to specify this as an input value for FindPython.
Setuptools supports the environment variable SETUPTOOLS_EXT_SUFFIX
for cross-compiling, some environments, like cibuildwheel, set this when cross-compiling. Not a great name for the variable, setting this via CMake variable is probably better.
Passing in something like -DPython_SOABI=...
would be ideal, since it doesn't require learning/documenting another variable, but I think it might not be supported in the current design, so some custom variable (like -DPython_TARGET_SOABI
or something) would be fine too. It would also be useful when not cross-compiling to avoid an extra Python process launch if the value is known ahead of time (like in scikit-build-core).
(Whatever is selected should support SOSABI, obviously, which is another count against the existing setuptools environment variable)
Thoughts?