1 /*=========================================================================
3 Program: Insight Segmentation & Registration Toolkit
4 Module: $RCSfile: cmSourceFilesRemoveCommand.cxx,v $
6 Date: $Date: 2002-06-27 19:57:09 $
7 Version: $Revision: 1.9 $
9 Copyright (c) 2002 Insight Consortium. All rights reserved.
10 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm 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 "cmSourceFilesRemoveCommand.h"
19 // cmSourceFilesRemoveCommand
20 bool cmSourceFilesRemoveCommand::InitialPass(std::vector
<std::string
> const& args
)
22 const char* versionValue
23 = m_Makefile
->GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION");
24 if (versionValue
&& atof(versionValue
) > 1.2)
26 this->SetError("The SOURCE_FILES_REMOVE command has been deprecated in CMake version 1.4. You should use the REMOVE command instead.\n");
32 this->SetError("called with incorrect number of arguments");
36 const char* variable
= args
[0].c_str(); // VAR is always first
38 const char* cacheValue
39 = m_Makefile
->GetDefinition(variable
);
41 // expand the variable
42 std::vector
<std::string
> varArgsExpanded
;
43 std::vector
<std::string
> temp
;
44 temp
.push_back(std::string(cacheValue
));
45 cmSystemTools::ExpandListArguments(temp
, varArgsExpanded
);
48 // check for REMOVE(VAR v1 v2 ... vn)
49 std::vector
<std::string
> argsExpanded
;
50 std::vector
<std::string
> temp2
;
51 for(unsigned int j
= 1; j
< args
.size(); ++j
)
53 temp2
.push_back(args
[j
]);
55 cmSystemTools::ExpandListArguments(temp2
, argsExpanded
);
57 // now create the new value
59 for(unsigned int j
= 0; j
< varArgsExpanded
.size(); ++j
)
62 for(unsigned int k
= 0; k
< argsExpanded
.size(); ++k
)
64 if (varArgsExpanded
[j
] == argsExpanded
[k
])
76 value
+= varArgsExpanded
[j
];
81 m_Makefile
->AddDefinition(variable
, value
.c_str());