From b37c0d7c6ca667c4babad66bb50d0a12561a081a Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Thu, 30 May 2024 11:38:03 +0200 Subject: [PATCH] CMake: Don't record provided targets for Qt6 package Due to QTBUG-125371 we currently record Qt6 as a third party dependency for many qt packages. Until that is fixed, we should not record the provided targets of the Qt6 package, because it causes issues during SBOM generation. Amends 58eefbd0b6169d0749b312268c1ae1e594e04362 Task-number: QTBUG-125371 Change-Id: I35d548996c3820aaa7a1175b3a1f34c23ec2290f Reviewed-by: Alexey Edelev --- cmake/QtFindPackageHelpers.cmake | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/cmake/QtFindPackageHelpers.cmake b/cmake/QtFindPackageHelpers.cmake index b0d0d8a4b6..af6057bf51 100644 --- a/cmake/QtFindPackageHelpers.cmake +++ b/cmake/QtFindPackageHelpers.cmake @@ -212,14 +212,17 @@ macro(qt_find_package) ${components_as_string}) endif() - # Record the package + component + optional component provided targets. - qt_internal_record_package_component_provided_targets( - PACKAGE_NAME "${ARGV0}" - ON_TARGET ${qt_find_package_target_name} - PROVIDED_TARGETS ${arg_PROVIDED_TARGETS} - COMPONENTS ${arg_COMPONENTS} - OPTIONAL_COMPONENTS ${arg_OPTIONAL_COMPONENTS} - ) + # Work around: QTBUG-125371 + if(NOT "${ARGV0}" STREQUAL "Qt6") + # Record the package + component + optional component provided targets. + qt_internal_record_package_component_provided_targets( + PACKAGE_NAME "${ARGV0}" + ON_TARGET ${qt_find_package_target_name} + PROVIDED_TARGETS ${arg_PROVIDED_TARGETS} + COMPONENTS ${arg_COMPONENTS} + OPTIONAL_COMPONENTS ${arg_OPTIONAL_COMPONENTS} + ) + endif() get_property(is_global TARGET ${qt_find_package_target_name} PROPERTY IMPORTED_GLOBAL)