From 0883c1667bcac64f9c33fa7adef42a346aec8417 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Thu, 13 Feb 2025 16:07:19 +0100 Subject: [PATCH] CMake: Always save SBOM python interpreter path To ensure that when we find the interpreter, but not some python dependency, we actually show the error about the dependency. Task-number: QTBUG-122899 Change-Id: Ib4f42e04f071f800d0f5bbe3700a1208e1017a19 Reviewed-by: Alexey Edelev (cherry picked from commit 46ee11a426292bc1538b5138501136b2dadc7173) Reviewed-by: Qt Cherry-pick Bot (cherry picked from commit ac0e10db65f62aace8f7d69e4b648afc968196c2) --- cmake/QtPublicSbomOpsHelpers.cmake | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/cmake/QtPublicSbomOpsHelpers.cmake b/cmake/QtPublicSbomOpsHelpers.cmake index 88df68445b..f4a6b8fc43 100644 --- a/cmake/QtPublicSbomOpsHelpers.cmake +++ b/cmake/QtPublicSbomOpsHelpers.cmake @@ -153,6 +153,13 @@ function(_qt_internal_sbom_find_and_handle_sbom_op_dependencies) _qt_internal_sbom_find_python_and_dependency_helper_lambda() endif() + # Always save the python interpreter path if it is found, even if the dependencies are not + # found. This improves the error message workflow. + if(python_found AND NOT QT_INTERNAL_SBOM_PYTHON_EXECUTABLE) + set(QT_INTERNAL_SBOM_PYTHON_EXECUTABLE "${python_path}" CACHE INTERNAL + "Python interpeter used for SBOM generation.") + endif() + if(NOT everything_found) if(arg_REQUIRED) set(message_type "FATAL_ERROR") @@ -177,11 +184,6 @@ function(_qt_internal_sbom_find_and_handle_sbom_op_dependencies) else() message(DEBUG "Using Python ${python_path} for running SBOM ops.") - if(NOT QT_INTERNAL_SBOM_PYTHON_EXECUTABLE) - set(QT_INTERNAL_SBOM_PYTHON_EXECUTABLE "${python_path}" CACHE INTERNAL - "Python interpeter used for SBOM generation.") - endif() - set(QT_INTERNAL_SBOM_DEPS_FOUND_FOR_${arg_OP_KEY} "TRUE" CACHE INTERNAL "All dependencies found to run SBOM OP ${arg_OP_KEY}") endif()