Provide option to ignore Cygwin
On Windows when building a codebase with an MSVC generator on a host that happens to have Cygwin installed, Cygwin path references (e.g. ../../../../cygdrive/c/cygwin/...) are included in the resulting MSVC project and solution files. When subsequently building, msbuild or Visual Studio can't resolve the path as provide and generate a missing file error. This was encountered and tested using Visual Studio 15 2017 Win64, but is expected to equally apply to other MSVC versions.
The specific error arises when building Qt5, which requires Perl during its build. The Cygwin perl.exe is the first one identified and therefore used. In theory, Cygwin Perl should be usable as long as all paths are transformed to Windows paths on output (a la cygpath). However, there's clearly at least one path which doesn't have that performed, but finding all such cases is likely quite a rabbit hole.
This issue is instead a request for a simpler solution - ignore the Cygwin installation entirely when building for an MSVC generator, unless specifically opted in. One would expect the same issue to apply using an NMAKE generator, but I'm not testing that specific case.
Related to the scope of the change, the 3.8.2 version of CMake includes references (and potential gotchas) for finding the Cygwin version of gnuplot, perl, SelfPackers, UnixCommands, and wget. In some cases the compatibility in the Cygwin tools may make them sufficient for a given build. In this case, however, Perl as installed as part of Git for Windows which is preferable (and found via local additional CMake extension modules).
For testing, the local FindCygwin.cmake has been edited with the following change.
-if (WIN32)
+if (WIN32 AND NOT MSVC)
While this is suitable for my specific use case, for backwards compatibility this specific fix may cause surprise for other users. As an alternative it may be preferable to provide an upstream opt-in option to exclude consideration of Cygwin executables instead of always assuming they're desired as is currently the case. Although the final naming of the property is not as important, the following would be greatly beneficial. My initial thought is to make it a per-target property for granularity.
-if (WIN32)
+if (WIN32 AND NOT CMAKE_IGNORE_CYGWIN)