From 240592fb833787bf93a68f038e024ff2a6ef785c Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Fri, 11 Oct 2024 10:39:21 -0700 Subject: [PATCH] pybind11 superbuild: set `PYTHON_EXECUTABLE` Signed-off-by: Axel Huebl --- cmake/dependencies/pybind11.cmake | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cmake/dependencies/pybind11.cmake b/cmake/dependencies/pybind11.cmake index 6719a38c37..19d31da31c 100644 --- a/cmake/dependencies/pybind11.cmake +++ b/cmake/dependencies/pybind11.cmake @@ -16,6 +16,15 @@ function(find_pybind11) message(STATUS "pybind11 repository: ${openPMD_pybind11_repo} (${openPMD_pybind11_branch})") endif() endif() + + # Propagate Python to pybind11 in superbuilds + if(openPMD_USE_INTERNAL_PYBIND11) + # we found Python via find_package(Python ...) below, but pybind11 has some + # additional internal logic in FindPythonLibsNew.cmake can mix things up + # https://github.com/openPMD/openPMD-api/pull/1677#issuecomment-2407743771 + set(PYTHON_EXECUTABLE ${Python_EXECUTABLE}) + endif() + if(TARGET pybind11::module) # nothing to do, target already exists in the superbuild elseif(openPMD_USE_INTERNAL_PYBIND11 AND openPMD_pybind11_src)