diff options
| author | Alexandru Croitor <[email protected]> | 2025-09-10 11:44:40 +0200 |
|---|---|---|
| committer | Alexandru Croitor <[email protected]> | 2025-09-17 16:54:18 +0200 |
| commit | 3c57c7fed6a5f65a8a7ebe677f841241eaace9e8 (patch) | |
| tree | 3dda5c363cd4b2b3cdfb07e23e3ec290578b72d8 /cmake | |
| parent | 1b37932de0f6fb0be6043bdea9f50d4aeffca188 (diff) | |
CMake: Add an SBOM LICENSE_DIR_PATHS project option
To allow specifying additional license directories via an option,
rather than via setting a QT_SBOM_LICENSE_DIRS variable in the parent
scope.
The old variable approach is kept for compatibility.
Pick-to: 6.8 6.9 6.10
Task-number: QTBUG-134894
Change-Id: Idae96c719dbc168b3366a0206c19393e27c7f76d
Reviewed-by: Joerg Bornemann <[email protected]>
Diffstat (limited to 'cmake')
| -rw-r--r-- | cmake/QtPublicSbomHelpers.cmake | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/cmake/QtPublicSbomHelpers.cmake b/cmake/QtPublicSbomHelpers.cmake index c5d54ed199e..25c6c52b1b1 100644 --- a/cmake/QtPublicSbomHelpers.cmake +++ b/cmake/QtPublicSbomHelpers.cmake @@ -47,6 +47,7 @@ function(_qt_internal_sbom_begin_project) ) set(multi_args COPYRIGHTS + LICENSE_DIR_PATHS ) cmake_parse_arguments(PARSE_ARGV 0 arg "${opt_args}" "${single_args}" "${multi_args}") @@ -285,15 +286,24 @@ function(_qt_internal_sbom_begin_project) list(APPEND license_dirs "${PROJECT_SOURCE_DIR}/LICENSES") endif() + set(license_dir_candidates "") + if(arg_LICENSE_DIR_PATHS) + list(APPEND license_dir_candidates ${arg_LICENSE_DIR_PATHS}) + endif() + # Allow specifying extra license dirs via a variable. Useful for standalone projects # like sqldrivers. + # Kept for backwards compatibility, the new LICENSE_DIR_PATHS option should be preferred. 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() + list(APPEND license_dir_candidates ${QT_SBOM_LICENSE_DIRS}) endif() + + foreach(license_dir IN LISTS license_dir_candidates) + if(EXISTS "${license_dir}") + list(APPEND license_dirs "${license_dir}") + endif() + endforeach() + list(REMOVE_DUPLICATES license_dirs) set(license_file_wildcard "LicenseRef-*.txt") |
