public static IEnumerable <CMakeKitInfo> ScanClangKits()
        {
            var clangRegex = new Regex(@"^clang(-\d+(\.\d+(\.\d+)?)?)?(\.exe)?$", RegexOptions.CultureInvariant);

            foreach (var clangFile in PathUtils.FindFilesInEnvironment(clangRegex))
            {
                var clangxxFile = clangFile.Replace("clang", "clang++");
                var version     = ClangVersionInfo.GetFrom(clangFile);
                if (version == null)
                {
                    continue;
                }
                if (version.Target.IndexOf("msvc") != -1)
                {
                    // Clang targeting MSVC can't be used without MSVC Enviroment
                    // These instances will be handled by using clang-cl.exe
                    continue;
                }
                var kitInfo = new CMakeKitInfo()
                {
                    Name      = $"Clang {version.Version} ({version.Target})",
                    Compilers = new Dictionary <string, string>()
                    {
                        { "C", clangFile }
                    }
                };
                if (File.Exists(clangxxFile))
                {
                    kitInfo.Compilers["CXX"] = clangxxFile;
                }
                yield return(kitInfo);
            }
        }
 public CMakeKit(CMakeKitInfo kitInfo)
 {
     this.kitInfo = kitInfo ?? throw new ArgumentNullException(nameof(kitInfo));
 }
        public static IEnumerable <CMakeKitInfo> ScanGccKits()
        {
            var searchPaths = PathUtils.GetSearchPaths();

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                searchPaths = searchPaths.Concat(new string[]
                {
                    "C:\\TDM-GCC-64\\bin",
                    "C:\\TDM-GCC-32\\bin"
                }.Select(PathUtils.NormalizePath));
            }
            searchPaths = searchPaths.Distinct();
            var gccRegex = new Regex(@"^((\w+-)*)gcc(-\d+(\.\d+(\.\d+)?)?)?(\.exe)?$", RegexOptions.CultureInvariant);
            var gccs     = PathUtils.FindFiles(gccRegex, searchPaths);
            var toolSet  = new HashSet <string>();

            foreach (var gccFile in gccs)
            {
                var gxxFile = gccFile.Replace("gcc", "g++");
                var version = GccVersionInfo.GetFrom(gccFile);
                if (version == null)
                {
                    continue;
                }
                if (toolSet.Contains(version.FullVersion))
                {
                    continue;
                }
                toolSet.Add(version.FullVersion);
                var kitInfo = new CMakeKitInfo()
                {
                    Name      = $"GCC {version.Version} ({version.Target})",
                    Compilers = new Dictionary <string, string>()
                    {
                        { "C", gccFile }
                    }
                };
                if (File.Exists(gxxFile))
                {
                    kitInfo.Compilers["CXX"] = gxxFile;
                }
                kitInfo.PreferredGenerator = FindNinja();
                if (kitInfo.PreferredGenerator == null &&
                    RuntimeInformation.IsOSPlatform(OSPlatform.Windows) &&
                    version.Target.EndsWith("-mingw32"))
                {
                    var mingw32Make = Path.Combine(Path.GetDirectoryName(gccFile), "mingw32-make.exe");
                    if (File.Exists(mingw32Make))
                    {
                        kitInfo.AdditionalPaths = new List <string>()
                        {
                            Path.GetDirectoryName(mingw32Make)
                        };
                        kitInfo.PreferredGenerator = new CMakeGeneratorInfo()
                        {
                            Name = "MinGW Makefiles"
                        };
                    }
                }
                yield return(kitInfo);
            }
        }