1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmRemoveCommand.cxx,v $
6 Date: $Date: 2008-01-23 15:27:59 $
7 Version: $Revision: 1.7 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
17 #include "cmRemoveCommand.h"
21 ::InitialPass(std::vector
<std::string
> const& args
, cmExecutionStatus
&)
28 const char* variable
= args
[0].c_str(); // VAR is always first
30 const char* cacheValue
31 = this->Makefile
->GetDefinition(variable
);
33 // if there is no old value then return
39 // expand the variable
40 std::vector
<std::string
> varArgsExpanded
;
41 cmSystemTools::ExpandListArgument(cacheValue
, varArgsExpanded
);
44 // check for REMOVE(VAR v1 v2 ... vn)
45 std::vector
<std::string
> argsExpanded
;
46 std::vector
<std::string
> temp
;
47 for(unsigned int j
= 1; j
< args
.size(); ++j
)
49 temp
.push_back(args
[j
]);
51 cmSystemTools::ExpandList(temp
, argsExpanded
);
53 // now create the new value
55 for(unsigned int j
= 0; j
< varArgsExpanded
.size(); ++j
)
58 for(unsigned int k
= 0; k
< argsExpanded
.size(); ++k
)
60 if (varArgsExpanded
[j
] == argsExpanded
[k
])
72 value
+= varArgsExpanded
[j
];
77 this->Makefile
->AddDefinition(variable
, value
.c_str());