On this page:
https://docs.cocos2d-x.org/cocos2d-x/v4/en/installation/CMake-Guide.html
instructions for creating Visual Studio project files are wrong. It will create a x64 project, which will not work, since at the moment Cocos2d-x is supports win32 only. What works is:
cmake .. -G "Visual Studio 16 2019" -Tv142 -A Win32
Without -A Win32 nothing will work.