1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmSetSourceFilesPropertiesCommand.cxx,v $
6 <<<<<<< cmSetSourceFilesPropertiesCommand.cxx
7 Date: $Date: 2008/02/15 16:22:23 $
8 Version: $Revision: 1.19 $
10 Date: $Date: 2008-05-08 19:49:53 $
11 Version: $Revision: 1.20 $
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 "cmSetSourceFilesPropertiesCommand.h"
24 #include "cmSourceFile.h"
26 // cmSetSourceFilesPropertiesCommand
27 bool cmSetSourceFilesPropertiesCommand
28 ::InitialPass(std::vector
<std::string
> const& args
, cmExecutionStatus
&)
32 this->SetError("called with incorrect number of arguments");
36 // break the arguments into source file names and properties
38 std::vector
<std::string
>::const_iterator j
;
40 // old style allows for specifier before PROPERTIES keyword
41 while (j
!= args
.end() &&
43 *j
!= "WRAP_EXCLUDE" &&
45 *j
!= "COMPILE_FLAGS" &&
46 *j
!= "OBJECT_DEPENDS" &&
53 // now call the worker function
56 cmSetSourceFilesPropertiesCommand
57 ::RunCommand(this->Makefile
,
59 args
.begin() + numFiles
,
60 args
.begin() + numFiles
,
64 this->SetError(errors
.c_str());
69 bool cmSetSourceFilesPropertiesCommand
70 ::RunCommand(cmMakefile
*mf
,
71 std::vector
<std::string
>::const_iterator filebeg
,
72 std::vector
<std::string
>::const_iterator fileend
,
73 std::vector
<std::string
>::const_iterator propbeg
,
74 std::vector
<std::string
>::const_iterator propend
,
77 std::vector
<std::string
> propertyPairs
;
78 bool generated
= false;
79 std::vector
<std::string
>::const_iterator j
;
80 // build the property pairs
81 for(j
= propbeg
; j
!= propend
;++j
)
83 // old style allows for specifier before PROPERTIES keyword
86 propertyPairs
.push_back("ABSTRACT");
87 propertyPairs
.push_back("1");
89 else if(*j
== "WRAP_EXCLUDE")
91 propertyPairs
.push_back("WRAP_EXCLUDE");
92 propertyPairs
.push_back("1");
94 else if(*j
== "GENERATED")
97 propertyPairs
.push_back("GENERATED");
98 propertyPairs
.push_back("1");
100 else if(*j
== "COMPILE_FLAGS")
102 propertyPairs
.push_back("COMPILE_FLAGS");
106 errors
= "called with incorrect number of arguments "
107 "COMPILE_FLAGS with no flags";
110 propertyPairs
.push_back(*j
);
112 else if(*j
== "OBJECT_DEPENDS")
114 propertyPairs
.push_back("OBJECT_DEPENDS");
118 errors
= "called with incorrect number of arguments "
119 "OBJECT_DEPENDS with no dependencies";
122 propertyPairs
.push_back(*j
);
124 else if(*j
== "PROPERTIES")
126 // now loop through the rest of the arguments, new style
130 propertyPairs
.push_back(*j
);
131 if(*j
== "GENERATED")
134 if(j
!= propend
&& cmSystemTools::IsOn(j
->c_str()))
145 errors
= "called with incorrect number of arguments.";
148 propertyPairs
.push_back(*j
);
151 // break out of the loop because j is already == end
156 errors
= "called with illegal arguments, maybe missing a "
157 "PROPERTIES specifier?";
162 // now loop over all the files
163 for(j
= filebeg
; j
!= fileend
;++j
)
165 // get the source file
167 mf
->GetOrCreateSource(j
->c_str(), generated
);
170 // now loop through all the props and set them
172 for (k
= 0; k
< propertyPairs
.size(); k
= k
+ 2)
174 sf
->SetProperty(propertyPairs
[k
].c_str(),propertyPairs
[k
+1].c_str());