summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Holland <dominik.holland@qt.io>2023-09-01 10:44:25 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-09-04 11:54:31 +0000
commitdb70771c0afeb13d93c4aa337bae9fe34724c85c (patch)
tree7bc029e66d30f4fb9cb5a9c60c5ab0e9fe573ac4
parentffb336db22d4aeba976e25642d5687e6543676c9 (diff)
CMake: Find the correct python3 interpreter when cross-compiling
When cross-compiling using a yocto SDK, find_package returns the target interpreter, which is incompatible. We need to explicitly search in the host sysroot for the python interpreter. Fixes: QTBUG-116662 Change-Id: Ia24a73ea3117cf38f930455a0758b17d3b86dff5 Reviewed-by: Bernd Weimer <bernd.weimer@qt.io> (cherry picked from commit e8c748e5f72848121358a0ae6896a4cb577015d6) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/interfaceframework/Qt6InterfaceFrameworkMacros.cmake5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/interfaceframework/Qt6InterfaceFrameworkMacros.cmake b/src/interfaceframework/Qt6InterfaceFrameworkMacros.cmake
index d7ba65cd..de39d53e 100644
--- a/src/interfaceframework/Qt6InterfaceFrameworkMacros.cmake
+++ b/src/interfaceframework/Qt6InterfaceFrameworkMacros.cmake
@@ -376,6 +376,11 @@ function(qt6_ifcodegen_generate)
list(APPEND CMD_ENV PYTHONHOME=${QT_IFCODEGEN_VIRTUALENV_PATH})
else() # qface installed in system
include(QtFindPackageHelpers)
+ # Make sure we search in the host Qt path if set. Otherwise me might end up with a
+ # interpreter for the target
+ if (NOT "${QT_HOST_PATH}" STREQUAL "")
+ set(CMAKE_PREFIX_PATH "${QT_HOST_PATH}")
+ endif()
qt_find_package(Python3 PROVIDED_TARGETS Python3::Interpreter MODULE_NAME interfaceframework)
set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
if (NOT Python3_EXECUTABLE)