1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmSetTestsPropertiesCommand.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 "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 std::vector
<cmTest
*> &tests
= *mf
->GetTests();
104 // now loop over all the targets
107 // if the file is already in the makefile just set properites on it
108 std::vector
<cmTest
*>::iterator it
;
109 for ( it
= tests
.begin(); it
!= tests
.end(); ++ it
)
112 if ( !strcmp(test
->GetName(),tname
))
114 // now loop through all the props and set them
115 for (k
= 0; k
< propertyPairs
.size(); k
= k
+ 2)
117 test
->SetProperty(propertyPairs
[k
].c_str(),
118 propertyPairs
[k
+1].c_str());
125 // if file is not already in the makefile, then add it
128 errors
= "Can not find test to add properties to: ";