public void Set(string variableName, string value, bool isEditable = true, CMakeCommand command = null)
        {
            variableName = ResolveString(variableName);
            value        = ResolveString(value);

            if (Contains(variableName))
            {
                CMakeVariable v = variables [variableName];
                v.Value      = value;
                v.IsEditable = false;
                v.Commands.Add(command);
                return;
            }

            AddVariable(variableName, value, isEditable, command);
        }
Example #2
0
        void TraverseArguments(CMakeCommand command, Action <string, CMakeCommand> callback, HashSet <CMakeCommand> commands = null)
        {
            CMakeVariableManager vm = parent.VariableManager;

            if (commands == null)
            {
                commands = new HashSet <CMakeCommand> ();
            }

            if (commands.Contains(command))
            {
                return;
            }

            commands.Add(command);

            foreach (var arg in command.Arguments)
            {
                foreach (var val in arg.GetValues())
                {
                    if (vm.IsVariable(val))
                    {
                        CMakeVariable v = vm.GetVariable(val.Substring(2, val.Length - 3));
                        if (v == null)
                        {
                            continue;
                        }

                        foreach (var c in v.Commands)
                        {
                            TraverseArguments(c, callback, commands);
                        }
                    }
                    else
                    {
                        callback(val, command);
                    }
                }
            }
        }