CMake: Sanitize nested SBOM attribution target names

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

Pick-to: 6.8 6.9
Task-number: QTBUG-122899
Change-Id: I65bec3b301f7fe1008cfd06aba3e1fbbb93f38c3
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Alexandru Croitor 2025-02-24 19:11:00 +01:00
parent 6cd7f0c09b
commit 4a0b5661fd

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