Visual Studio generators create VC project files even if the solution only has enabled Fortran
When generating Visual Studio solutions and project files for a Fortran-only project, CMake correctly creates
.vfproj project files for the binary targets, but any other targets (like custom targets or support targets like install) are generated as
.vcproj files for Visual C/C++. This makes those projects unusable if Visual C++ is not installed, and in some VS versions it can also cause a crash on build.
In particular, with Intel Fortran 12.0 installed with the Visual Studio 2008 "shell only" (that is, without VC++), the VS shell cannot load the "support projects"
ZERO_CHECK. Since all projects depend on the latter, this appears to trigger some bug in VS2008 that crashes the VS shell. I guess that in other versions of VS, it will simply refuse to build because a project depends on another that is not (and cannot be) loaded.
The root cause is that the choice of the project type depends on
cmGlobalVisualStudioGenerator::TargetIsFortranOnly(cmGeneratorTarget const*), which returns true if and only if the target in question has a single language enabled and that language is Fortran. However, the "support" projects mentioned above have no languages enabled at all, so CMake falls back to the default of creating a VC++ project.
I propose a patch with a simple solution: since Fortran projects can also carry custom actions,
TargetIsFortranOnly should also return true if the target has no languages enabled but the overall CMake project has enabled only Fortran (ignoring RC, the resource compiler). Thus, for a project which only has Fortran enabled, the "support" targets would be created as
.vfproj files, while for a mixed C/Fortran project (or for a project without Fortran) the current
.vcproj default would be kept.