CMake: Find ZLIB before gRPC in the standalone examples


...like we do with OpenSSL. And we already did the same fix for tests.

The standalone gRPC server examples find gRPC inside a block that sets
CMAKE_FIND_PACKAGE_PREFER_CONFIG to TRUE. gRPC's package config exports
gRPC::grpc with ZLIB::ZLIB in its link interface, but only resolves that
target itself via a guarded "if(NOT ZLIB_FOUND) find_package(ZLIB)".

Find ZLIB up front in MODULE mode, before enabling
CMAKE_FIND_PACKAGE_PREFER_CONFIG, so that ZLIB::ZLIB exists in the
consuming scope before gRPC is found. This mirrors the existing OpenSSL
handling and the same fix already done for the standalone tests.

Pick-to: 6.12
Change-Id: I63f74abc0b1798ffd73181a7ad716415ce8c1bb6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
commit9126ca31e0b5c3bfd5f49df3aa720234a2964a0a
parent3074ed48e1f03f1b16943abd9ebbb7257566b155
authorJoerg Bornemann <joerg.bornemann@qt.io>
committerJoerg Bornemann <joerg.bornemann@qt.io>
commit timeThu, 13 Aug 2026 11:49:42 +0000