CMake: Handle DESTDIR for SBOM doc references in top-level builds

When installing a top-level build using the DESTDIR env var mechanism,
the SBOM generation process could not find the qtbase sbom document,
while generating the qtshadertools document.

Make sure to prepend the DESTDIR env var to the install-time install
prefix, when looking for external SBOM documents.

Pick-to: 6.8
Fixes: QTBUG-132188
Change-Id: I1cdb75842fc552b43d982f05444b5ddc1fe58595
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit f2ce68d8f31f4c90471183d66075bd6fd5955d6a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Alexandru Croitor 2025-01-03 16:32:42 +01:00 committed by Qt Cherry-pick Bot
parent 7b356f0f31
commit 0e14e9042d

View File

@ -751,7 +751,7 @@ function(_qt_internal_sbom_generate_add_external_reference)
# Always append the install time install prefix.
# The variable is escaped, so it is evaluated during cmake install time, so that the value
# can be overridden with cmake --install . --prefix <path>.
list(APPEND install_prefixes "\${CMAKE_INSTALL_PREFIX}")
list(APPEND install_prefixes "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}")
if(arg_INSTALL_PREFIXES)
list(APPEND install_prefixes ${arg_INSTALL_PREFIXES})