Make COMPILE_LANGUAGE generator expression work in Visual Studio
When the COMPILE_LANGUAGE
generator expression was introduced it was left out of the Visual Studio generators. One reason is because VS uses only one set of target-wide flags for both C and C++. This was a technical limitation but also a reason the lack of the feature didn't matter very much. However, with introduction of support for CUDA, this limitation becomes much more problematic. Since VS does use separate target-wide flags for CUDA, it should be possible to make COMPILE_LANGUAGE
work for it.
The problem of distinguishing C and C++ flags remains. We already deal with this for CMAKE_{C,CXX}_FLAGS
by just picking one of the two to use for the whole target. The choice is based on the linker language. See logic here.