If you want to use C++20 modules, this example may help you. It runs with MSVC, Clang and GNU Compiler.
There have been major changes in CMake lately, but it is dependent on a couple of patches: https://www.kitware.com/import-cmake-c20-modules/
With the approach in this project you can use older versions of compilers and cmake.