CMake: Only record existing system library targets for SBOM
In certain cases the qt_find_package(PROVIDED_TARGETS) might not exist, so we shouldn't record the targets for SBOM spdx id registration in that case. Amends 37a5e001277db9e1392a242171ab2b88cb6c3049 Pick-to: 6.8 Task-number: QTBUG-122899 Change-Id: Iada6b5a20a3e7526f18ae4385db8a29fee68ab36 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
parent
9279a2f60e
commit
0f5699ee3d
@ -1417,7 +1417,17 @@ function(_qt_internal_sbom_record_system_library_spdx_ids)
|
||||
foreach(target IN LISTS recorded_targets)
|
||||
get_property(args GLOBAL PROPERTY
|
||||
_qt_internal_sbom_recorded_system_library_spdx_options_${target})
|
||||
|
||||
# qt_find_package PROVIDED_TARGETS might refer to non-existent targets in certain cases,
|
||||
# like zstd::libzstd_shared for qt_find_package(WrapZSTD), because we are not sure what
|
||||
# kind of zstd build was done. Make sure to check if the target exists before recording it.
|
||||
if(TARGET "${target}")
|
||||
_qt_internal_sbom_record_system_library_spdx_id(${target} ${args})
|
||||
else()
|
||||
message(DEBUG
|
||||
"Skipping recording system library for SBOM because target does not exist: "
|
||||
" ${target}")
|
||||
endif()
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user