CMake: Fix SBOM PROJECT_COMMENT CMP0174 related warning

We should only pass PROJECT_COMMENT if it has a value.
We also need to escape semicolons, because the project comment might
contain the qt configure line, and that might have passed arguments
like -qpa offscreen\;xcb

Pick-to: 6.8
Change-Id: I934cf75c376b3466ba91a433d009e6eaa77a60fa
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit ea575585e7eaccb628cdb342c8dd49396a3c52a2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Alexey Edelev 2025-03-05 11:05:10 +01:00 committed by Qt Cherry-pick Bot
parent 72e6a5fec0
commit 7537bfbadf

View File

@ -214,6 +214,12 @@ function(_qt_internal_sbom_begin_project)
endif()
endif()
if(project_comment)
# Escape any potential semicolons.
string(REPLACE ";" "\\;" project_comment "${project_comment}")
set(project_comment PROJECT_COMMENT "${project_comment}")
endif()
_qt_internal_sbom_begin_project_generate(
OUTPUT "${repo_spdx_install_path}"
OUTPUT_RELATIVE_PATH "${repo_spdx_relative_install_path}"
@ -223,7 +229,7 @@ function(_qt_internal_sbom_begin_project)
SUPPLIER_URL "${repo_supplier_url}"
DOWNLOAD_LOCATION "${download_location}"
PROJECT "${repo_project_name_lowercase}"
PROJECT_COMMENT "${project_comment}"
${project_comment}
PROJECT_FOR_SPDX_ID "${repo_project_name_for_spdx_id}"
NAMESPACE "${repo_spdx_namespace}"
CPE "${qt_cpe}"