CMake: Register lookup of Tools packages in cross-builds without deps


When building a cross-built Qt with QT_FORCE_BUILD_TOOLS=ON, if the
necessary dependencies for protobufgen and grpcgen are not available,
the tools will not be built, and as a consequence the target
Qt6<Module>Dependencies.cmake file won't register a host Tools package
dependency.

To fix that, adjust the condition that does the extra registration to
happen also when QT_FORCE_BUILD_TOOLS is ON, but the tool features are
OFF, which means the dependencies were not found.

This fixes example as external project builds for yocto CI platforms
where the above situation happens. Specifically the
find_package(Qt6 COMPONENTS Protobuf) will now do a
find_package(Qt6 COMPONENTS ProtobufTools), and similarly for the Grpc
module.

Amends 9b0eb4c95a5004a6b043e453e599240f60280efa

Pick-to: 6.12
Task-number: QTBUG-90820
Task-number: QTBUG-96232
Change-Id: Ibaa0c658655d6d69d20ecf06dd841c191d52b04b
Reviewed-by: Orkun Tokdemir <orkun.tokdemir@qt.io>
commit17f02c0e88e196fd81938f98f6015b1ca4833fd7
parentebcd77a3ab056fcec5b99019a5ea43c0b8500a02
authorAlexandru Croitor <alexandru.croitor@qt.io>
committerAlexandru Croitor <alexandru.croitor@qt.io>
commit timeThu, 30 Jul 2026 14:56:52 +0000