1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmSetTargetPropertiesCommand.cxx,v $
6 Date: $Date: 2008-08-19 15:43:51 $
7 Version: $Revision: 1.10 $
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"
18 #include "cmLocalGenerator.h"
19 #include "cmGlobalGenerator.h"
21 // cmSetTargetPropertiesCommand
22 bool cmSetTargetPropertiesCommand
23 ::InitialPass(std::vector
<std::string
> const& args
, cmExecutionStatus
&)
27 this->SetError("called with incorrect number of arguments");
31 // first collect up the list of files
32 std::vector
<std::string
> propertyPairs
;
33 bool doingFiles
= true;
35 std::vector
<std::string
>::const_iterator j
;
36 for(j
= args
.begin(); j
!= args
.end();++j
)
38 if(*j
== "PROPERTIES")
41 // now loop through the rest of the arguments, new style
43 while (j
!= args
.end())
45 propertyPairs
.push_back(*j
);
49 this->SetError("called with incorrect number of arguments.");
52 propertyPairs
.push_back(*j
);
55 // break out of the loop because j is already == end
64 this->SetError("called with illegal arguments, maybe missing "
65 "a PROPERTIES specifier?");
69 if(propertyPairs
.size() == 0)
71 this->SetError("called with illegal arguments, maybe missing "
72 "a PROPERTIES specifier?");
76 // now loop over all the targets
78 for(i
= 0; i
< numFiles
; ++i
)
80 bool ret
= cmSetTargetPropertiesCommand::SetOneTarget
81 (args
[i
].c_str(),propertyPairs
,this->Makefile
);
84 std::string message
= "Can not find target to add properties to: ";
86 this->SetError(message
.c_str());
93 bool cmSetTargetPropertiesCommand
94 ::SetOneTarget(const char *tname
,
95 std::vector
<std::string
> &propertyPairs
,
98 if(cmTarget
* target
= mf
->FindTargetToUse(tname
))
100 // now loop through all the props and set them
102 for (k
= 0; k
< propertyPairs
.size(); k
= k
+ 2)
104 target
->SetProperty(propertyPairs
[k
].c_str(),
105 propertyPairs
[k
+1].c_str());
106 target
->CheckProperty(propertyPairs
[k
].c_str(), mf
);
109 // if file is not already in the makefile, then add it