mirror of
https://github.com/pybind/pybind11.git
synced 2026-03-14 20:27:47 +00:00
fix(cmake): improved cross-compilation support (#5083)
* fix(cmake): do not use Python::Interpreter when cross-compiling * chore: apply cmake-format to pybind11NewTools.cmake * fix(cmake): do not look for Python Interpreter component when cross-compiling * feat(cmake): guess Python extension suffix * fix: add pybind11GuessPythonExtSuffix.cmake to packaging test * Use PYBIND11_CROSSCOMPILING instead of CMAKE_CROSSCOMPILING * refactor: require PYBIND11_USE_CROSSCOMPILING Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> --------- Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
This commit is contained in:
@@ -42,6 +42,16 @@ set(pybind11_INCLUDE_DIRS
|
||||
"${pybind11_INCLUDE_DIR}"
|
||||
CACHE INTERNAL "Include directory for pybind11 (Python not requested)")
|
||||
|
||||
if(CMAKE_CROSSCOMPILING AND PYBIND11_USE_CROSSCOMPILING)
|
||||
set(_PYBIND11_CROSSCOMPILING
|
||||
ON
|
||||
CACHE INTERNAL "")
|
||||
else()
|
||||
set(_PYBIND11_CROSSCOMPILING
|
||||
OFF
|
||||
CACHE INTERNAL "")
|
||||
endif()
|
||||
|
||||
# --------------------- Shared targets ----------------------------
|
||||
|
||||
# Build an interface library target:
|
||||
@@ -195,7 +205,7 @@ endif()
|
||||
|
||||
# --------------------- pybind11_find_import -------------------------------
|
||||
|
||||
if(NOT _pybind11_nopython)
|
||||
if(NOT _pybind11_nopython AND NOT _PYBIND11_CROSSCOMPILING)
|
||||
# Check to see if modules are importable. Use REQUIRED to force an error if
|
||||
# one of the modules is not found. <package_name>_FOUND will be set if the
|
||||
# package was found (underscores replace dashes if present). QUIET will hide
|
||||
|
||||
Reference in New Issue
Block a user