public CMakeVariableDeclarations(List <string> userVariables, CMakeVariableType type) { AddItems(GetStandardVariables(type), ItemType.Variable); if (userVariables != null) { AddItems(userVariables, ItemType.Variable); } }
private static List <string> GetStandardVariables(CMakeVariableType type) { List <string> vars = new List <string>(); switch (type) { case CMakeVariableType.Variable: case CMakeVariableType.CacheVariable: // All cache variables also serve as ordinary CMake variables, but not // the other way around. if (type == CMakeVariableType.Variable) { vars.AddRange(_standardVariables); } vars.AddRange(_standardCacheVariables); string path = CMakePath.FindCMakeModules(); if (path != null) { IEnumerable <string> languages = CMakeLanguageDeclarations.GetLanguagesFromDir(path); foreach (string language in languages) { if (type == CMakeVariableType.Variable) { vars.AddRange(_standardLangVariables.Select( x => string.Format(x, language))); } vars.AddRange(_standardLangCacheVariables.Select( x => string.Format(x, language))); } } break; case CMakeVariableType.EnvVariable: vars.AddRange(_standardEnvVariables); break; } return(vars); }
private static List<string> GetStandardVariables(CMakeVariableType type) { List<string> vars = new List<string>(); switch (type) { case CMakeVariableType.Variable: case CMakeVariableType.CacheVariable: // All cache variables also serve as ordinary CMake variables, but not // the other way around. if (type == CMakeVariableType.Variable) { vars.AddRange(_standardVariables); } vars.AddRange(_standardCacheVariables); string path = CMakePath.FindCMakeModules(); if (path != null) { IEnumerable<string> languages = CMakeLanguageDeclarations.GetLanguagesFromDir(path); foreach (string language in languages) { if (type == CMakeVariableType.Variable) { vars.AddRange(_standardLangVariables.Select( x => string.Format(x, language))); } vars.AddRange(_standardLangCacheVariables.Select( x => string.Format(x, language))); } } break; case CMakeVariableType.EnvVariable: vars.AddRange(_standardEnvVariables); break; } return vars; }
/// <summary> /// Check whether the given string names a standard variable. /// </summary> /// <param name="varName">The string to check.</param> /// <param name="type">The type of variable to check for.</param> /// <returns> /// True if the string names a standard variable or false otherwise. /// </returns> public static bool IsStandardVariable(string varName, CMakeVariableType type) { return GetStandardVariables(type).IndexOf(varName) >= 0; }
public CMakeVariableDeclarations(List<string> userVariables, CMakeVariableType type) { AddItems(GetStandardVariables(type), ItemType.Variable); if (userVariables != null) { AddItems(userVariables, ItemType.Variable); } }
/// <summary> /// Check whether the given string names a standard variable. /// </summary> /// <param name="varName">The string to check.</param> /// <param name="type">The type of variable to check for.</param> /// <returns> /// True if the string names a standard variable or false otherwise. /// </returns> public static bool IsStandardVariable(string varName, CMakeVariableType type) { return(GetStandardVariables(type).IndexOf(varName) >= 0); }