Skip to content

Commit 55b399f

Browse files
committed
CMake: Don't use root attribution file for system libraries
A project's root qt_attribution.json file might be picked up by the build system when recording system libraries for SBOM processing. One such case is qtgrpc. This caused generation errors in qtgrpc with the following message: CMake Error: Files to be generated by multiple different commands: qt_sbom/SPDXRef-Package-qtgrpc-qt-3rdparty-sources-WrapProtobuf.cmake This started happening since the SBOM options are now implicitly propagated to auto-created attribution targets, and each attribution target attempted to generate to the same partial sbom file. Any qt attribution file in the project root is not intended to be used for system libraries, so explicitly disable using the root attribution file for all system libraries. As a more long-term fix, we should consider making the partial sbom files be more unique. Amends 5daabb5 Pick-to: 6.8 Task-number: QTBUG-122899 Change-Id: I67544c299e630597f26602d270cd1dfd54cccfb6 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
1 parent b956a90 commit 55b399f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cmake/QtPublicSbomHelpers.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1654,6 +1654,12 @@ function(_qt_internal_sbom_add_recorded_system_libraries)
16541654
continue()
16551655
endif()
16561656

1657+
# Automatic system library sbom recording happens at project root source dir scope, which
1658+
# means it might accidentally pick up a qt_attribution.json file from the project root,
1659+
# that is not intended to be use for system libraries.
1660+
# For now, explicitly disable using the root attribution file.
1661+
list(APPEND args NO_CURRENT_DIR_ATTRIBUTION)
1662+
16571663
list(APPEND generated_package_names "${package_name}")
16581664
set(sbom_generated_${package_name} TRUE)
16591665

0 commit comments

Comments
 (0)