From fbbe5f294669043e7afef621912c8bb42f6e2ec7 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Fri, 17 Dec 2021 15:21:37 +0100 Subject: CMake: Fix lookup of Python for qtdeclarative Always use FindPython instead of find_program because the former looks for Python in more locations (like the Windows registry). We switch to FindPython instead of FindPythonInterp because the latter is deprecated, and the former is available in our minimum support CMake version (3.16). Because find_package is called in configure.cmake that is called by a function() call, we need to make the found interpreter a cache variable to make it available outside of the function. Fixes: QTBUG-99273 Change-Id: Idb6620a01b4b5764f130f9dc5780d73cd2151965 Reviewed-by: Fabian Kosmale (cherry picked from commit e0eb75b2a0578f4ef401bb6eaa8c4f320ffa2078) Reviewed-by: Qt Cherry-pick Bot --- src/qml/configure.cmake | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/qml/configure.cmake') diff --git a/src/qml/configure.cmake b/src/qml/configure.cmake index 11c29620d6..a587a8fe1d 100644 --- a/src/qml/configure.cmake +++ b/src/qml/configure.cmake @@ -7,9 +7,12 @@ #### Libraries -# special case begin qt_find_package(LTTngUST PROVIDED_TARGETS LTTng::UST MODULE_NAME qml QMAKE_LIB lttng-ust) -# special case end +qt_find_package(Python REQUIRED) +if(Python_Interpreter_FOUND) + # Need to make it globally available to the project + set(QT_INTERNAL_DECLARATIVE_PYTHON "${Python_EXECUTABLE}" CACHE STRING "") +endif() #### Tests @@ -200,13 +203,9 @@ qt_feature("qml-xmllistmodel" PRIVATE CONDITION QT_FEATURE_qml_itemmodel AND QT_FEATURE_future ) -# special case begin -qt_qml_find_python(__qt_qml_python_path __qt_qml_python_found) -# special case end - qt_feature("qml-python" PRIVATE LABEL "python" - CONDITION __qt_qml_python_found # special case + CONDITION Python_Interpreter_FOUND ) qt_configure_add_summary_section(NAME "Qt QML") qt_configure_add_summary_entry(ARGS "qml-network") -- cgit v1.2.3