The MSVC compiler is actually a program called cl.exe, so after opening the developer command prompt for VS 2022, do some simple checks as shown in the following image to make sure the compiler is in the path. For cmake, you can set the environment variables CC and CXX to the compiler (use the full path). CC is what cmake will use for CMAKE_C_COMPILER and CXX is what cmake will use for CMAKE_CXX_COMPILER. MSVC uses the same compiler for both C and C++.
1 Like