Adding a compiler flag globally which is only used by a single library isn't the nicest thing to do. I'd do it if there's no other way.
However, you could try to define these flags where the static library is used, similar to https://aur.archlinux.org/cgit/aur.git/tree/0003-Fix-using-static-PCRE2-and-DBus-1.patch?h=mingw-w64-qt6-base-static.
If pkgconfig is used, one can also set the corresponding variables like it is done for brotli (in https://aur.archlinux.org/cgit/aur.git/tree/toolchain-mingw-static.cmake?h=mingw-w64-cmake-static). When I remember correctly those are cache variables so you should be able to find the relevant variables by checking the CMake cache file.
If a CMake find module is used, then one can usually also override some variables.
Pinned Comments
Martchus commented on 2021-08-11 12:45 (UTC) (edited on 2021-08-11 12:48 (UTC) by Martchus)
This package is mainly intended to achieve a statically linked build of Qt applications using the
mingw-w64-qt6-*-static
packages by preferring linking against static libraries (instead of dynamic libraries) and adding some workarounds (see also https://github.com/Martchus/PKGBUILDs#tested-build-and-deployment-tools-for-mingw-w64-qt6-packages).