1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmSetTestsPropertiesCommand.cxx,v $
6 Date: $Date: 2009-01-05 20:00:57 $
7 Version: $Revision: 1.8 $
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 "cmSetTestsPropertiesCommand.h"
22 // cmSetTestsPropertiesCommand
23 bool cmSetTestsPropertiesCommand
24 ::InitialPass(std::vector
<std::string
> const& args
, cmExecutionStatus
&)
28 this->SetError("called with incorrect number of arguments");
32 // first collect up the list of files
33 std::vector
<std::string
> propertyPairs
;
34 bool doingFiles
= true;
36 std::vector
<std::string
>::const_iterator j
;
37 for(j
= args
.begin(); j
!= args
.end();++j
)
39 if(*j
== "PROPERTIES")
42 // now loop through the rest of the arguments, new style
44 while (j
!= args
.end())
46 propertyPairs
.push_back(*j
);
50 this->SetError("called with incorrect number of arguments.");
53 propertyPairs
.push_back(*j
);
56 // break out of the loop because j is already == end
65 this->SetError("called with illegal arguments, maybe "
66 "missing a PROPERTIES specifier?");
70 if(propertyPairs
.size() == 0)
72 this->SetError("called with illegal arguments, maybe "
73 "missing a PROPERTIES specifier?");
78 // now loop over all the targets
80 for(i
= 0; i
< numFiles
; ++i
)
84 cmSetTestsPropertiesCommand::SetOneTest(args
[i
].c_str(),
86 this->Makefile
, errors
);
89 this->SetError(errors
.c_str());
98 bool cmSetTestsPropertiesCommand
99 ::SetOneTest(const char *tname
,
100 std::vector
<std::string
> &propertyPairs
,
101 cmMakefile
*mf
, std::string
&errors
)
103 if(cmTest
* test
= mf
->GetTest(tname
))
105 // now loop through all the props and set them
107 for (k
= 0; k
< propertyPairs
.size(); k
= k
+ 2)
109 test
->SetProperty(propertyPairs
[k
].c_str(),
110 propertyPairs
[k
+1].c_str());
115 errors
= "Can not find test to add properties to: ";