1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmSetTargetPropertiesCommand.cxx,v $
6 <<<<<<< cmSetTargetPropertiesCommand.cxx
7 Date: $Date: 2008/01/28 13:38:36 $
8 Version: $Revision: 1.9 $
10 Date: $Date: 2008-08-19 15:43:51 $
11 Version: $Revision: 1.10 $
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 "cmSetTargetPropertiesCommand.h"
23 #include "cmLocalGenerator.h"
24 #include "cmGlobalGenerator.h"
26 // cmSetTargetPropertiesCommand
27 bool cmSetTargetPropertiesCommand
28 ::InitialPass(std::vector
<std::string
> const& args
, cmExecutionStatus
&)
32 this->SetError("called with incorrect number of arguments");
36 // first collect up the list of files
37 std::vector
<std::string
> propertyPairs
;
38 bool doingFiles
= true;
40 std::vector
<std::string
>::const_iterator j
;
41 for(j
= args
.begin(); j
!= args
.end();++j
)
43 if(*j
== "PROPERTIES")
46 // now loop through the rest of the arguments, new style
48 while (j
!= args
.end())
50 propertyPairs
.push_back(*j
);
54 this->SetError("called with incorrect number of arguments.");
57 propertyPairs
.push_back(*j
);
60 // break out of the loop because j is already == end
69 this->SetError("called with illegal arguments, maybe missing "
70 "a PROPERTIES specifier?");
74 if(propertyPairs
.size() == 0)
76 this->SetError("called with illegal arguments, maybe missing "
77 "a PROPERTIES specifier?");
81 // now loop over all the targets
83 for(i
= 0; i
< numFiles
; ++i
)
85 bool ret
= cmSetTargetPropertiesCommand::SetOneTarget
86 (args
[i
].c_str(),propertyPairs
,this->Makefile
);
89 std::string message
= "Can not find target to add properties to: ";
91 this->SetError(message
.c_str());
98 bool cmSetTargetPropertiesCommand
99 ::SetOneTarget(const char *tname
,
100 std::vector
<std::string
> &propertyPairs
,
103 if(cmTarget
* target
= mf
->FindTargetToUse(tname
))
105 // now loop through all the props and set them
107 for (k
= 0; k
< propertyPairs
.size(); k
= k
+ 2)
109 target
->SetProperty(propertyPairs
[k
].c_str(),
110 propertyPairs
[k
+1].c_str());
111 target
->CheckProperty(propertyPairs
[k
].c_str(), mf
);
114 // if file is not already in the makefile, then add it