qtbase/cmake/QtSbomHelpers.cmake
Alexandru Croitor 43e166bd08 CMake: Support manual multiple projects within-a-repo SBOM generation
Certain repositories like qtwebengine contain multiple projects from
the perspective of online installer packaging. In this case the
QtWebEngine and QtPdf projects are expected to have separate SBOM
documents.

Introduce a new QT_SKIP_SBOM_AUTO_PROJECT variable that can be set
before qt_build_repo to disable the auto-generation of an SBOM
document for the current repo project.

Introduce two new internal functions
qt_internal_sbom_begin/end_qt_repo_project to allow to manually start
and end the SBOM generation for a project within a repo.

Because the intermediate file names that assemble the SBOM use the
project name as a key, and the project name would be the same for
qtwebengine, allow differentiating between the current project name
and the real qt repo project name.

The current project name is used for the file names, whereas the
real qt repo project name is used to extract the dependencies on
other repos, to ensure correct dependency build rules.

As a drive-by, improve the document dir path search list when an SBOM
document can't be found.

Pick-to: 6.8
Task-number: QTBUG-128893
Task-number: QTBUG-122899
Change-Id: I61b68098242e7c49b98420265c29af78303c3233
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2024-12-05 15:37:00 +01:00

34 lines
932 B
CMake

# Copyright (C) 2024 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
# For now these are simple internal forwarding wrappers for the public counterparts, which are
# meant to be used in qt repo CMakeLists.txt files.
function(qt_internal_add_sbom)
_qt_internal_add_sbom(${ARGN})
endfunction()
function(qt_internal_extend_sbom)
_qt_internal_extend_sbom(${ARGN})
endfunction()
function(qt_internal_sbom_add_license)
_qt_internal_sbom_add_license(${ARGN})
endfunction()
function(qt_internal_extend_sbom_dependencies)
_qt_internal_extend_sbom_dependencies(${ARGN})
endfunction()
function(qt_find_package_extend_sbom)
_qt_find_package_extend_sbom(${ARGN})
endfunction()
function(qt_internal_sbom_begin_qt_repo_project)
_qt_internal_sbom_begin_qt_repo_project(${ARGN})
endfunction()
function(qt_internal_sbom_end_qt_repo_project)
_qt_internal_sbom_end_qt_repo_project(${ARGN})
endfunction()