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.

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>
(cherry picked from commit 0e14e9042d5f9237cff14584b7a3c814535a5544)
This commit is contained in:
Alexandru Croitor 2025-01-03 16:32:42 +01:00 committed by Qt Cherry-pick Bot
parent c803b1f534
commit 195f53eeaa

View File

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