file(ARCHIVE_CREATE) fails when zstd archive format is not compiled in
Qt6 is doing a system introspection for
libzstd and if found it assumes it can use it.
Unfortunately on some Linux distributions (I think gentoo) CMake is not built with libarchive using libzstd, and when Qt6's CMake code tries to use
ztsd format it fails with:
CMake Error: archive_write_header: Format must be set before you can write to an archive.
Here is the bug report on the Qt side: https://bugreports.qt.io/browse/QTBUG-89108
Note that the official Kitware Linux CMake binaries have no problems.