1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmSetTestsPropertiesCommand.cxx,v $
6 <<<<<<< cmSetTestsPropertiesCommand.cxx
7 Date: $Date: 2008/01/23 15:27:59 $
8 Version: $Revision: 1.7 $
10 Date: $Date: 2009-01-05 20:00:57 $
11 Version: $Revision: 1.8 $
14 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
15 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
17 This software is distributed WITHOUT ANY WARRANTY; without even
18 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
19 PURPOSE. See the above copyright notices for more information.
21 =========================================================================*/
22 #include "cmSetTestsPropertiesCommand.h"
27 // cmSetTestsPropertiesCommand
28 bool cmSetTestsPropertiesCommand
29 ::InitialPass(std::vector
<std::string
> const& args
, cmExecutionStatus
&)
33 this->SetError("called with incorrect number of arguments");
37 // first collect up the list of files
38 std::vector
<std::string
> propertyPairs
;
39 bool doingFiles
= true;
41 std::vector
<std::string
>::const_iterator j
;
42 for(j
= args
.begin(); j
!= args
.end();++j
)
44 if(*j
== "PROPERTIES")
47 // now loop through the rest of the arguments, new style
49 while (j
!= args
.end())
51 propertyPairs
.push_back(*j
);
55 this->SetError("called with incorrect number of arguments.");
58 propertyPairs
.push_back(*j
);
61 // break out of the loop because j is already == end
70 this->SetError("called with illegal arguments, maybe "
71 "missing a PROPERTIES specifier?");
75 if(propertyPairs
.size() == 0)
77 this->SetError("called with illegal arguments, maybe "
78 "missing a PROPERTIES specifier?");
83 // now loop over all the targets
85 for(i
= 0; i
< numFiles
; ++i
)
89 cmSetTestsPropertiesCommand::SetOneTest(args
[i
].c_str(),
91 this->Makefile
, errors
);
94 this->SetError(errors
.c_str());
103 bool cmSetTestsPropertiesCommand
104 ::SetOneTest(const char *tname
,
105 std::vector
<std::string
> &propertyPairs
,
106 cmMakefile
*mf
, std::string
&errors
)
108 if(cmTest
* test
= mf
->GetTest(tname
))
110 // now loop through all the props and set them
112 for (k
= 0; k
< propertyPairs
.size(); k
= k
+ 2)
114 test
->SetProperty(propertyPairs
[k
].c_str(),
115 propertyPairs
[k
+1].c_str());
120 errors
= "Can not find test to add properties to: ";