1 /*============================================================================
2 CMake - Cross Platform Makefile Generator
3 Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
5 Distributed under the OSI-approved BSD License (the "License");
6 see accompanying file Copyright.txt for details.
8 This software is distributed WITHOUT ANY WARRANTY; without even the
9 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 See the License for more information.
11 ============================================================================*/
12 #include "cmRemoveCommand.h"
16 ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
23 const char* variable = args[0].c_str(); // VAR is always first
25 const char* cacheValue
26 = this->Makefile->GetDefinition(variable);
28 // if there is no old value then return
34 // expand the variable
35 std::vector<std::string> varArgsExpanded;
36 cmSystemTools::ExpandListArgument(cacheValue, varArgsExpanded);
39 // check for REMOVE(VAR v1 v2 ... vn)
40 std::vector<std::string> argsExpanded;
41 std::vector<std::string> temp;
42 for(unsigned int j = 1; j < args.size(); ++j)
44 temp.push_back(args[j]);
46 cmSystemTools::ExpandList(temp, argsExpanded);
48 // now create the new value
50 for(unsigned int j = 0; j < varArgsExpanded.size(); ++j)
53 for(unsigned int k = 0; k < argsExpanded.size(); ++k)
55 if (varArgsExpanded[j] == argsExpanded[k])
67 value += varArgsExpanded[j];
72 this->Makefile->AddDefinition(variable, value.c_str());