aboutsummaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2021-12-17 15:21:37 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-01-24 12:01:00 +0000
commitfbbe5f294669043e7afef621912c8bb42f6e2ec7 (patch)
tree798a63bcf00f402df7dac9eb15b235d01d211112 /cmake
parent6d5050d383692b80a78fe7563c5f78c0b7631f73 (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 'cmake')
-rw-r--r--cmake/QtDeclarativeSetup.cmake16
1 files changed, 1 insertions, 15 deletions
diff --git a/cmake/QtDeclarativeSetup.cmake b/cmake/QtDeclarativeSetup.cmake
index 82cfbd935f..98ea95dd58 100644
--- a/cmake/QtDeclarativeSetup.cmake
+++ b/cmake/QtDeclarativeSetup.cmake
@@ -35,8 +35,6 @@ function(qt_declarative_write_tag_header target_name)
endif()
endfunction()
-find_package(PythonInterp REQUIRED)
-
# Generate a header file containing a regular expression jit table.
function(qt_declarative_generate_reg_exp_jit_tables consuming_target)
set(generate_dir "${CMAKE_CURRENT_BINARY_DIR}/.generated")
@@ -51,21 +49,9 @@ function(qt_declarative_generate_reg_exp_jit_tables consuming_target)
add_custom_command(
OUTPUT "${output_file}"
- COMMAND "${PYTHON_EXECUTABLE}" ${retgen_script_file} ${output_file}
+ COMMAND "${QT_INTERNAL_DECLARATIVE_PYTHON}" ${retgen_script_file} ${output_file}
MAIN_DEPENDENCY ${retgen_script_file}
)
target_sources(${consuming_target} PRIVATE ${output_file})
target_include_directories(${consuming_target} PRIVATE $<BUILD_INTERFACE:${generate_dir}>)
endfunction()
-
-function(qt_qml_find_python out_var_path out_var_found)
- find_program(QT_QML_PYTHON_PATH
- NAMES python python2 python3 py
- DOC "Qt Declarative python path")
- if(QT_QML_PYTHON_PATH)
- set(${out_var_path} "${QT_QML_PYTHON_PATH}" PARENT_SCOPE)
- set(${out_var_found} "TRUE" PARENT_SCOPE)
- else()
- set(${out_var_found} "FALSE" PARENT_SCOPE)
- endif()
-endfunction()