MSVC variable is not set correctly if LANGUAGES is NONE
Minimal project which demonstrates the problem:
cmake_minimum_required(VERSION 3.16)
project(Example LANGUAGES NONE)
if(MSVC)
message(STATUS "MSVC is true")
else()
message(STATUS "MSVC is false")
endif()
Run CMake with a Visual Studio generator (I am using VS2019) and it claims the MSVC
variable is false. Change LANGUAGES NONE
to LANGUAGES C
and it claims the MSVC
variable is true.