CMake: Sanitize nested SBOM attribution target names

To avoid issues with characters like "/" which might come from
attribution ids.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I65bec3b301f7fe1008cfd06aba3e1fbbb93f38c3
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 4a0b5661fdd1f1120018efb5f08bfbc1ed16cc13)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Alexandru Croitor 2025-02-24 19:11:00 +01:00 committed by Qt Cherry-pick Bot
parent 59745fc798
commit 1dc3a9cac2

View File

@ -164,6 +164,11 @@ function(_qt_internal_sbom_handle_qt_attribution_files out_prefix_outer)
string(APPEND attribution_target "${${out_prefix}_attribution_id}")
endif()
# Sanitize the target name, to avoid issues with slashes and other unsupported chars
# in target names.
string(REGEX REPLACE "[^a-zA-Z0-9_-]" "_"
attribution_target "${attribution_target}")
set(sbom_args "")
# Always propagate the package supplier, because we assume the supplier for 3rd