CMake compiler autodetection does not work for emscripten when generator is set to Visual Studio

Actually I don’t know if it is a problem of cmake or emscripten. emscripten is a toolchain that compiles C/C++ code to webassembly so that they can be run in web browsers.
Here is the toolchain cmake file that we need to use:

And here is my CMakeLists.txt:

cmake_minimum_required(VERSION 4.0)
project(playground C CXX)

message(STATUS "CMAKE_C_COMPILER:${CMAKE_C_COMPILER}")
message(STATUS "CMAKE_CXX_COMPILER_ID: ${CMAKE_CXX_COMPILER_ID}")

When I use it with NMake, everything works fine:

cmake -DCMAKE_TOOLCHAIN_FILE=C:\src\emsdk\upstream\emscripten\cmake/Modules/Platform/Emscripten.cmake -DCMAKE_BUILD_TYPE=Release -G "NMake Makefiles" ..

The output was:

-- The C compiler identification is Clang 21.0.0
-- The CXX compiler identification is Clang 21.0.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/src/emsdk/upstream/emscripten/emcc.bat - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/src/emsdk/upstream/emscripten/em++.bat - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- CMAKE_C_COMPILER:C:/src/emsdk/upstream/emscripten/emcc.bat
-- CMAKE_CXX_COMPILER_ID: Clang
-- Configuring done (3.7s)
-- Generating done (0.0s)
-- Build files have been written to: C:/src/t1/b

However, when I set the generator to Visual Studio, the values of “CMAKE_C_COMPILER” and “CMAKE_C_COMPILER_ID” mismatch. CMake always thinks that CMAKE_C_COMPILER_ID is MSVC.