CMake: Fix standalone build of sqldrivers with SBOM
The standalone build of the sqldrivers plugin never called the SBOM project begin and end functions. This cause an error in qt_internal_add_plugin which tried to read the SBOM project name. Replace the calls to qt_prepare_standalone_project and qt_print_feature_summary with qt_build_repo_begin and qt_build_repo_end. This ensures the SBOM project is setup, as well as many other behaviors that a standalone internal build of a module is expected to have. Additionally we need to tell the SBOM project where to find the licenses for the standalone build. This is done by setting the new QT_SBOM_LICENSE_DIRS variable to the qtbase license directory. Pick-to: 6.8 Fixes: QTBUG-131799 Change-Id: I2e31ecffdff28561d1c4a6b8fbcd8125188d2c48 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
parent
9bb9016b80
commit
df30953228
@ -216,7 +216,29 @@ function(_qt_internal_sbom_begin_project)
|
||||
_qt_internal_get_current_project_sbom_dir(sbom_dir)
|
||||
set_property(GLOBAL APPEND PROPERTY _qt_internal_sbom_dirs "${sbom_dir}")
|
||||
|
||||
file(GLOB license_files "${PROJECT_SOURCE_DIR}/LICENSES/LicenseRef-*.txt")
|
||||
# Collect project licenses.
|
||||
set(license_dirs "")
|
||||
|
||||
if(EXISTS "${PROJECT_SOURCE_DIR}/LICENSES")
|
||||
list(APPEND license_dirs "${PROJECT_SOURCE_DIR}/LICENSES")
|
||||
endif()
|
||||
|
||||
# Allow specifying extra license dirs via a variable. Useful for standalone projects
|
||||
# like sqldrivers.
|
||||
if(QT_SBOM_LICENSE_DIRS)
|
||||
foreach(license_dir IN LISTS QT_SBOM_LICENSE_DIRS)
|
||||
if(EXISTS "${license_dir}")
|
||||
list(APPEND license_dirs "${license_dir}")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
list(REMOVE_DUPLICATES license_dirs)
|
||||
|
||||
set(license_file_wildcard "LicenseRef-*.txt")
|
||||
list(TRANSFORM license_dirs APPEND "/${license_file_wildcard}" OUTPUT_VARIABLE license_globs)
|
||||
|
||||
file(GLOB license_files ${license_globs})
|
||||
|
||||
foreach(license_file IN LISTS license_files)
|
||||
get_filename_component(license_id "${license_file}" NAME_WLE)
|
||||
_qt_internal_sbom_add_license(
|
||||
|
@ -23,7 +23,9 @@ if(NOT PROJECT_NAME STREQUAL "QtBase" AND NOT PROJECT_NAME STREQUAL "Qt")
|
||||
Core
|
||||
Sql
|
||||
)
|
||||
qt_prepare_standalone_project()
|
||||
# Use qtbase license files for standalone builds.
|
||||
set(QT_SBOM_LICENSE_DIRS "${PROJECT_SOURCE_DIR}/../../../LICENSES")
|
||||
qt_build_repo_begin()
|
||||
else()
|
||||
qt_internal_upgrade_cmake_policies()
|
||||
endif()
|
||||
@ -77,5 +79,5 @@ if(QT_FEATURE_sql_mimer)
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_PROJECT_NAME STREQUAL "QtBase" AND NOT CMAKE_PROJECT_NAME STREQUAL "Qt")
|
||||
qt_print_feature_summary()
|
||||
qt_build_repo_end()
|
||||
endif()
|
||||
|
Loading…
x
Reference in New Issue
Block a user