From 37ea573216fa8947e127249daac65e10217ffe06 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Thu, 27 Feb 2025 15:43:08 +0100 Subject: [PATCH] CMake: Include license and license file attribution in SBOM comment Some attribution entries don't have a SPDX license id specified, in that case it's good to at least include the free-form license name and file path. Task-number: QTBUG-122899 Change-Id: I75bb5c30645684ea74fe94da92ea30eb29965ad4 Reviewed-by: Alexey Edelev (cherry picked from commit cf9f09cd60e3db37643ac6cf6cfd51aa00749892) Reviewed-by: Qt Cherry-pick Bot (cherry picked from commit 2769ef7174839578c26b2c7c260d76bce59fe8ca) --- cmake/QtPublicSbomAttributionHelpers.cmake | 5 ++--- cmake/QtPublicSbomHelpers.cmake | 8 ++++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/cmake/QtPublicSbomAttributionHelpers.cmake b/cmake/QtPublicSbomAttributionHelpers.cmake index 27a1959e666..22e80b464e0 100644 --- a/cmake/QtPublicSbomAttributionHelpers.cmake +++ b/cmake/QtPublicSbomAttributionHelpers.cmake @@ -415,11 +415,10 @@ function(_qt_internal_sbom_read_qt_attribution out_prefix) endif() if(arg_GET_DEFAULT_KEYS) - # Some calls are currently commented out, to save on json parsing time because we don't have - # a usage for them yet. - # _qt_internal_sbom_get_attribution_key(License license) _qt_internal_sbom_get_attribution_key(Id attribution_id "${out_prefix}") _qt_internal_sbom_get_attribution_key(LicenseId license_id "${out_prefix}") + _qt_internal_sbom_get_attribution_key(License license "${out_prefix}") + _qt_internal_sbom_get_attribution_key(LicenseFile license_file "${out_prefix}") _qt_internal_sbom_get_attribution_key(Version version "${out_prefix}") _qt_internal_sbom_get_attribution_key(Homepage homepage "${out_prefix}") _qt_internal_sbom_get_attribution_key(Name attribution_name "${out_prefix}") diff --git a/cmake/QtPublicSbomHelpers.cmake b/cmake/QtPublicSbomHelpers.cmake index 472b48508ff..f9f83dd1185 100644 --- a/cmake/QtPublicSbomHelpers.cmake +++ b/cmake/QtPublicSbomHelpers.cmake @@ -996,6 +996,14 @@ function(_qt_internal_sbom_add_target target) if(qa_qt_usage) string(APPEND package_comment " Qt usage: ${qa_qt_usage}\n") endif() + + if(qa_license) + string(APPEND package_comment " License: ${qa_license}\n") + endif() + + if(qa_license_file) + string(APPEND package_comment " License file: ${qa_license_file}\n") + endif() endif() if(package_comment)