diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2021-12-17 15:21:37 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-01-24 12:01:00 +0000 |
commit | fbbe5f294669043e7afef621912c8bb42f6e2ec7 (patch) | |
tree | 798a63bcf00f402df7dac9eb15b235d01d211112 /src | |
parent | 6d5050d383692b80a78fe7563c5f78c0b7631f73 (diff) |
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 <fabian.kosmale@qt.io>
(cherry picked from commit e0eb75b2a0578f4ef401bb6eaa8c4f320ffa2078)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/configure.cmake | 13 |
1 files changed, 6 insertions, 7 deletions
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") |