1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmSetTargetPropertiesCommand.cxx,v $
6 Date: $Date: 2002-12-21 16:14:47 $
7 Version: $Revision: 1.1 $
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 "cmSetTargetPropertiesCommand.h"
19 // cmSetTargetPropertiesCommand
20 bool cmSetTargetPropertiesCommand::InitialPass(
21 std::vector
<std::string
> const& args
)
25 this->SetError("called with incorrect number of arguments");
29 // first collect up the list of files
30 std::vector
<std::string
> propertyPairs
;
31 bool doingFiles
= true;
33 std::vector
<std::string
>::const_iterator j
;
34 for(j
= args
.begin(); j
!= args
.end();++j
)
36 if(*j
== "PROPERTIES")
39 // now loop through the rest of the arguments, new style
41 while (j
!= args
.end())
43 propertyPairs
.push_back(*j
);
47 this->SetError("called with incorrect number of arguments.");
50 propertyPairs
.push_back(*j
);
53 // break out of the loop because j is already == end
62 this->SetError("called with illegal arguments, maybe missing a PROPERTIES specifier?");
66 if(propertyPairs
.size() == 0)
68 this->SetError("called with illegal arguments, maybe missing a PROPERTIES specifier?");
72 cmTargets
& targets
= m_Makefile
->GetTargets();
73 // now loop over all the targets
76 for(i
= 0; i
< numFiles
; ++i
)
78 // if the file is already in the makefile just set properites on it
79 cmTargets::iterator t
= targets
.find(args
[i
]);
80 if ( t
!= targets
.end())
82 cmTarget
& target
= t
->second
;
83 // now loop through all the props and set them
84 for (k
= 0; k
< propertyPairs
.size(); k
= k
+ 2)
86 target
.SetProperty(propertyPairs
[k
].c_str(),propertyPairs
[k
+1].c_str());
89 // if file is not already in the makefile, then add it
92 std::string message
= "Can not find target to add properties to: ";
94 this->SetError(message
.c_str());