CMake: Pass parent package SPDX ID to custom file SBOM generation

Otherwise we generate an invalid package by setting FilesAnalyzed to
false, even though the package has custom files.

Add a check that the parent package SPDX ID is always set when
generating a file entry.

Amends 5180b172d9

Pick-to: 6.8 6.9 6.10
Change-Id: Ia96802c98e2d946b1360b5e32525a3ecf4cd2750
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
This commit is contained in:
Alexandru Croitor 2025-08-13 17:47:30 +02:00
parent 632b9c4dcd
commit 516ffe8275
2 changed files with 3 additions and 0 deletions

View File

@ -730,6 +730,7 @@ function(_qt_internal_sbom_add_custom_file target installed_file_relative_path)
FILENAME "${installed_file_relative_path}"
FILETYPE "${file_type}" ${optional}
SPDXID "${spdx_id}"
PARENT_PACKAGE_SPDXID "${arg_PACKAGE_SPDX_ID}"
${file_common_options}
${config_to_install_option}
${relationship_option}

View File

@ -589,6 +589,8 @@ function(_qt_internal_sbom_generate_add_file)
HINTS "SPDXRef-${arg_FILENAME}"
)
_qt_internal_sbom_set_default_option_value_and_error_if_empty(PARENT_PACKAGE_SPDXID "")
_qt_internal_sbom_set_default_option_value(LICENSE "NOASSERTION")
_qt_internal_sbom_set_default_option_value(COPYRIGHT "NOASSERTION")