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 "cmSetTestsPropertiesCommand.h"
17 // cmSetTestsPropertiesCommand
18 bool cmSetTestsPropertiesCommand
19 ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
23 this->SetError("called with incorrect number of arguments");
27 // first collect up the list of files
28 std::vector<std::string> propertyPairs;
29 bool doingFiles = true;
31 std::vector<std::string>::const_iterator j;
32 for(j= args.begin(); j != args.end();++j)
34 if(*j == "PROPERTIES")
37 // now loop through the rest of the arguments, new style
39 while (j != args.end())
41 propertyPairs.push_back(*j);
45 this->SetError("called with incorrect number of arguments.");
48 propertyPairs.push_back(*j);
51 // break out of the loop because j is already == end
60 this->SetError("called with illegal arguments, maybe "
61 "missing a PROPERTIES specifier?");
65 if(propertyPairs.size() == 0)
67 this->SetError("called with illegal arguments, maybe "
68 "missing a PROPERTIES specifier?");
73 // now loop over all the targets
75 for(i = 0; i < numFiles; ++i)
79 cmSetTestsPropertiesCommand::SetOneTest(args[i].c_str(),
81 this->Makefile, errors);
84 this->SetError(errors.c_str());
93 bool cmSetTestsPropertiesCommand
94 ::SetOneTest(const char *tname,
95 std::vector<std::string> &propertyPairs,
96 cmMakefile *mf, std::string &errors)
98 if(cmTest* test = mf->GetTest(tname))
100 // now loop through all the props and set them
102 for (k = 0; k < propertyPairs.size(); k = k + 2)
104 test->SetProperty(propertyPairs[k].c_str(),
105 propertyPairs[k+1].c_str());
110 errors = "Can not find test to add properties to: ";