compile C++20 modules with cmake

Hi
I have two files main.cpp and module1.cpp (simple hello_world example)
I want to build them with cmake.
following is cmake code (not working)

cmake_minimum_required(VERSION 3.21)
project(cpp_concurrency_masterclass)
SET(CMAKE_CXX_STANDARD 20)
SET(CMAKE_CXX_FLAGS “-fmodules-ts”)
add_executable(main module1.cpp main.cpp)

on command line following works perfectly
g++ -fmodules-ts module1.cpp main.cpp

but with cmake it generates seperate object file for each source file and then while compiling main.cpp it can not find the module1.
Did not find any simple answer on google either.

CMake does not yet support modules out of the box. See this issue where updates will be posted as they happen.