chore(cmake): Add an author warning that auto-calculated PYTHON_MODULE_EXTENSION may not respect SETUPTOOLS_EXT_SUFFIX during cross-compilation (#5495)

This commit is contained in:
Xuehai Pan
2025-01-25 06:21:05 +08:00
committed by GitHub
parent c19c291b98
commit 924261e814
2 changed files with 20 additions and 0 deletions

View File

@@ -171,6 +171,16 @@ if(NOT _PYBIND11_CROSSCOMPILING)
set(PYTHON_MODULE_EXTENSION
"${_PYTHON_MODULE_EXTENSION}"
CACHE INTERNAL "")
if((NOT "$ENV{SETUPTOOLS_EXT_SUFFIX}" STREQUAL "")
AND (NOT "$ENV{SETUPTOOLS_EXT_SUFFIX}" STREQUAL "${PYTHON_MODULE_EXTENSION}"))
message(
AUTHOR_WARNING,
"SETUPTOOLS_EXT_SUFFIX is set to \"$ENV{SETUPTOOLS_EXT_SUFFIX}\", "
"but the auto-calculated Python extension suffix is \"${PYTHON_MODULE_EXTENSION}\". "
"This may cause problems when importing the Python extensions. "
"If you are using cross-compiling Python, you may need to "
"set PYTHON_MODULE_EXTENSION manually.")
endif()
endif()
endif()
else()