Check on CMAKE_GENERATOR instead of MSVC_VERSION OR XCODE_VERSION

The old check for some reason does not work every time