CMake: Fix CMP0174 warnings in SBOM generation code
Change-Id: Iabe959eda65a0bf7dd94b20cfce7d55642f9096d Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit aee347e0a7710d7d2242cf89e9ab5b125a33ef61) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
10e6d8688b
commit
a9296ab86c
@ -572,9 +572,14 @@ function(_qt_internal_sbom_generate_add_file)
|
|||||||
qt_internal_sbom_set_default_option_value_and_error_if_empty(FILENAME "")
|
qt_internal_sbom_set_default_option_value_and_error_if_empty(FILENAME "")
|
||||||
qt_internal_sbom_set_default_option_value_and_error_if_empty(FILETYPE "")
|
qt_internal_sbom_set_default_option_value_and_error_if_empty(FILETYPE "")
|
||||||
|
|
||||||
|
set(check_option "")
|
||||||
|
if(arg_SPDXID)
|
||||||
|
set(check_option "CHECK" "${arg_SPDXID}")
|
||||||
|
endif()
|
||||||
|
|
||||||
_qt_internal_sbom_get_and_check_spdx_id(
|
_qt_internal_sbom_get_and_check_spdx_id(
|
||||||
VARIABLE arg_SPDXID
|
VARIABLE arg_SPDXID
|
||||||
CHECK "${arg_SPDXID}"
|
${check_option}
|
||||||
HINTS "SPDXRef-${arg_FILENAME}"
|
HINTS "SPDXRef-${arg_FILENAME}"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -811,9 +816,14 @@ function(_qt_internal_sbom_generate_add_package)
|
|||||||
|
|
||||||
qt_internal_sbom_set_default_option_value_and_error_if_empty(PACKAGE "")
|
qt_internal_sbom_set_default_option_value_and_error_if_empty(PACKAGE "")
|
||||||
|
|
||||||
|
set(check_option "")
|
||||||
|
if(arg_SPDXID)
|
||||||
|
set(check_option "CHECK" "${arg_SPDXID}")
|
||||||
|
endif()
|
||||||
|
|
||||||
_qt_internal_sbom_get_and_check_spdx_id(
|
_qt_internal_sbom_get_and_check_spdx_id(
|
||||||
VARIABLE arg_SPDXID
|
VARIABLE arg_SPDXID
|
||||||
CHECK "${arg_SPDXID}"
|
${check_option}
|
||||||
HINTS "SPDXRef-${arg_PACKAGE}"
|
HINTS "SPDXRef-${arg_PACKAGE}"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -940,9 +950,14 @@ function(_qt_internal_sbom_generate_add_license)
|
|||||||
|
|
||||||
qt_internal_sbom_set_default_option_value_and_error_if_empty(LICENSE_ID "")
|
qt_internal_sbom_set_default_option_value_and_error_if_empty(LICENSE_ID "")
|
||||||
|
|
||||||
|
set(check_option "")
|
||||||
|
if(arg_SPDXID)
|
||||||
|
set(check_option "CHECK" "${arg_SPDXID}")
|
||||||
|
endif()
|
||||||
|
|
||||||
_qt_internal_sbom_get_and_check_spdx_id(
|
_qt_internal_sbom_get_and_check_spdx_id(
|
||||||
VARIABLE arg_SPDXID
|
VARIABLE arg_SPDXID
|
||||||
CHECK "${arg_SPDXID}"
|
${check_option}
|
||||||
HINTS "SPDXRef-${arg_LICENSE_ID}"
|
HINTS "SPDXRef-${arg_LICENSE_ID}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -139,6 +139,11 @@ function(_qt_internal_sbom_begin_project)
|
|||||||
set(repo_license "")
|
set(repo_license "")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set(repo_license_option "")
|
||||||
|
if(repo_license)
|
||||||
|
set(repo_license_option "LICENSE" "${repo_license}")
|
||||||
|
endif()
|
||||||
|
|
||||||
if(arg_COPYRIGHTS)
|
if(arg_COPYRIGHTS)
|
||||||
list(JOIN arg_COPYRIGHTS "\n" arg_COPYRIGHTS)
|
list(JOIN arg_COPYRIGHTS "\n" arg_COPYRIGHTS)
|
||||||
set(repo_copyright "<text>${arg_COPYRIGHTS}</text>")
|
set(repo_copyright "<text>${arg_COPYRIGHTS}</text>")
|
||||||
@ -178,7 +183,7 @@ function(_qt_internal_sbom_begin_project)
|
|||||||
_qt_internal_sbom_begin_project_generate(
|
_qt_internal_sbom_begin_project_generate(
|
||||||
OUTPUT "${repo_spdx_install_path}"
|
OUTPUT "${repo_spdx_install_path}"
|
||||||
OUTPUT_RELATIVE_PATH "${repo_spdx_relative_install_path}"
|
OUTPUT_RELATIVE_PATH "${repo_spdx_relative_install_path}"
|
||||||
LICENSE "${repo_license}"
|
${repo_license_option}
|
||||||
COPYRIGHT "${repo_copyright}"
|
COPYRIGHT "${repo_copyright}"
|
||||||
SUPPLIER "${repo_supplier}" # This must not contain spaces!
|
SUPPLIER "${repo_supplier}" # This must not contain spaces!
|
||||||
SUPPLIER_URL "${repo_supplier_url}"
|
SUPPLIER_URL "${repo_supplier_url}"
|
||||||
@ -754,11 +759,18 @@ function(_qt_internal_sbom_add_target target)
|
|||||||
${purl_multi_args}
|
${purl_multi_args}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(supplier)
|
||||||
list(APPEND purl_args SUPPLIER "${supplier}")
|
list(APPEND purl_args SUPPLIER "${supplier}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(package_version)
|
||||||
list(APPEND purl_args VERSION "${package_version}")
|
list(APPEND purl_args VERSION "${package_version}")
|
||||||
|
endif()
|
||||||
|
|
||||||
if(is_qt_entity_type)
|
if(is_qt_entity_type)
|
||||||
list(APPEND purl_args IS_QT_ENTITY_TYPE)
|
list(APPEND purl_args IS_QT_ENTITY_TYPE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(qa_purls)
|
if(qa_purls)
|
||||||
list(APPEND purl_args PURL_3RDPARTY_UPSTREAM_VALUES "${qa_purls}")
|
list(APPEND purl_args PURL_3RDPARTY_UPSTREAM_VALUES "${qa_purls}")
|
||||||
endif()
|
endif()
|
||||||
@ -852,6 +864,16 @@ function(_qt_internal_sbom_add_target target)
|
|||||||
${multi_config_single_args}
|
${multi_config_single_args}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set(copyrights_option "")
|
||||||
|
if(copyrights)
|
||||||
|
set(copyrights_option COPYRIGHTS "${copyrights}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(license_option "")
|
||||||
|
if(license_expression)
|
||||||
|
set(license_option LICENSE_EXPRESSION "${license_expression}")
|
||||||
|
endif()
|
||||||
|
|
||||||
_qt_internal_sbom_handle_target_binary_files("${target}"
|
_qt_internal_sbom_handle_target_binary_files("${target}"
|
||||||
${no_install_option}
|
${no_install_option}
|
||||||
${framework_option}
|
${framework_option}
|
||||||
@ -859,8 +881,8 @@ function(_qt_internal_sbom_add_target target)
|
|||||||
TYPE "${arg_TYPE}"
|
TYPE "${arg_TYPE}"
|
||||||
${target_binary_multi_config_args}
|
${target_binary_multi_config_args}
|
||||||
SPDX_ID "${package_spdx_id}"
|
SPDX_ID "${package_spdx_id}"
|
||||||
COPYRIGHTS "${copyrights}"
|
${copyrights_option}
|
||||||
LICENSE_EXPRESSION "${license_expression}"
|
${license_option}
|
||||||
)
|
)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
@ -1923,9 +1945,14 @@ function(_qt_internal_extend_sbom target)
|
|||||||
# relationships for other targets, even if the target was not yet finalized.
|
# relationships for other targets, even if the target was not yet finalized.
|
||||||
if(arg_TYPE)
|
if(arg_TYPE)
|
||||||
# Friendly package name is allowed to be empty.
|
# Friendly package name is allowed to be empty.
|
||||||
|
set(package_name_option "")
|
||||||
|
if(arg_FRIENDLY_PACKAGE_NAME)
|
||||||
|
set(package_name_option PACKAGE_NAME "${arg_FRIENDLY_PACKAGE_NAME}")
|
||||||
|
endif()
|
||||||
|
|
||||||
_qt_internal_sbom_record_target_spdx_id(${target}
|
_qt_internal_sbom_record_target_spdx_id(${target}
|
||||||
TYPE "${arg_TYPE}"
|
TYPE "${arg_TYPE}"
|
||||||
PACKAGE_NAME "${arg_FRIENDLY_PACKAGE_NAME}"
|
${package_name_option}
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -3189,26 +3216,38 @@ function(_qt_internal_sbom_handle_purl_values target)
|
|||||||
|
|
||||||
# Add a vcs_url to the generic QT variant.
|
# Add a vcs_url to the generic QT variant.
|
||||||
if(purl_variant STREQUAL "QT")
|
if(purl_variant STREQUAL "QT")
|
||||||
|
set(entity_vcs_url_version_option "")
|
||||||
|
# Can be empty.
|
||||||
|
if(QT_SBOM_GIT_HASH_SHORT)
|
||||||
|
set(entity_vcs_url_version_option VERSION "${QT_SBOM_GIT_HASH_SHORT}")
|
||||||
|
endif()
|
||||||
|
|
||||||
_qt_internal_sbom_get_qt_entity_vcs_url(${target}
|
_qt_internal_sbom_get_qt_entity_vcs_url(${target}
|
||||||
REPO_NAME "${repo_project_name_lowercase}"
|
REPO_NAME "${repo_project_name_lowercase}"
|
||||||
VERSION "${QT_SBOM_GIT_HASH_SHORT}" # can be empty
|
${entity_vcs_url_version_option}
|
||||||
OUT_VAR vcs_url)
|
OUT_VAR vcs_url)
|
||||||
list(APPEND purl_args PURL_QUALIFIERS "vcs_url=${vcs_url}")
|
list(APPEND purl_args PURL_QUALIFIERS "vcs_url=${vcs_url}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Add the subdirectory path where the target was created as a custom qualifier.
|
# Add the subdirectory path where the target was created as a custom qualifier.
|
||||||
_qt_internal_sbom_get_qt_entity_repo_source_dir(${target} OUT_VAR sub_path)
|
_qt_internal_sbom_get_qt_entity_repo_source_dir(${target} OUT_VAR sub_path)
|
||||||
|
if(sub_path)
|
||||||
list(APPEND purl_args PURL_SUBPATH "${sub_path}")
|
list(APPEND purl_args PURL_SUBPATH "${sub_path}")
|
||||||
|
endif()
|
||||||
|
|
||||||
# Add the target name as a custom qualifer.
|
# Add the target name as a custom qualifer.
|
||||||
list(APPEND purl_args PURL_QUALIFIERS "library_name=${target}")
|
list(APPEND purl_args PURL_QUALIFIERS "library_name=${target}")
|
||||||
|
|
||||||
|
# Can be empty.
|
||||||
|
if(QT_SBOM_GIT_HASH_SHORT)
|
||||||
|
list(APPEND purl_args VERSION "${QT_SBOM_GIT_HASH_SHORT}")
|
||||||
|
endif()
|
||||||
|
|
||||||
# Get purl args the Qt entity type, taking into account defaults.
|
# Get purl args the Qt entity type, taking into account defaults.
|
||||||
_qt_internal_sbom_get_qt_entity_purl_args(${target}
|
_qt_internal_sbom_get_qt_entity_purl_args(${target}
|
||||||
NAME "${repo_project_name_lowercase}-${target}"
|
NAME "${repo_project_name_lowercase}-${target}"
|
||||||
REPO_NAME "${repo_project_name_lowercase}"
|
REPO_NAME "${repo_project_name_lowercase}"
|
||||||
SUPPLIER "${arg_SUPPLIER}"
|
SUPPLIER "${arg_SUPPLIER}"
|
||||||
VERSION "${QT_SBOM_GIT_HASH_SHORT}" # can be empty
|
|
||||||
PURL_VARIANT "${purl_variant}"
|
PURL_VARIANT "${purl_variant}"
|
||||||
${purl_args}
|
${purl_args}
|
||||||
OUT_VAR purl_args
|
OUT_VAR purl_args
|
||||||
@ -3307,11 +3346,16 @@ function(_qt_internal_sbom_get_qt_entity_purl_args target)
|
|||||||
set(purl_version "${arg_PURL_VERSION}")
|
set(purl_version "${arg_PURL_VERSION}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set(purl_version_option "")
|
||||||
|
if(purl_version)
|
||||||
|
set(purl_version_option PURL_VERSION "${purl_version}")
|
||||||
|
endif()
|
||||||
|
|
||||||
set(purl_args
|
set(purl_args
|
||||||
PURL_TYPE "${purl_type}"
|
PURL_TYPE "${purl_type}"
|
||||||
PURL_NAMESPACE "${purl_namespace}"
|
PURL_NAMESPACE "${purl_namespace}"
|
||||||
PURL_NAME "${purl_name}"
|
PURL_NAME "${purl_name}"
|
||||||
PURL_VERSION "${purl_version}"
|
${purl_version_option}
|
||||||
)
|
)
|
||||||
|
|
||||||
if(arg_PURL_QUALIFIERS)
|
if(arg_PURL_QUALIFIERS)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user