CMake: Check for target existence before recording system lib spdx id

Otherwise the spdx id recording function might fail when trying to
retrieve the spdx id from the non-existent target.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I1f6b3d7bc88ff4aa28de1468cd86152747cc3bdb
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Alexandru Croitor 2024-10-17 16:01:22 +02:00
parent f0d6bfb242
commit 4e120f265c

View File

@ -1576,7 +1576,7 @@ function(_qt_internal_sbom_record_system_library_usage target)
)
get_cmake_property(sbom_repo_begin_called _qt_internal_sbom_repo_begin_called)
if(sbom_repo_begin_called)
if(sbom_repo_begin_called AND TARGET "${target}")
_qt_internal_sbom_record_system_library_spdx_id(${target} ${spdx_options})
else()
set_property(GLOBAL PROPERTY