summaryrefslogtreecommitdiff
path: root/Source/cmSetSourceFilesPropertiesCommand.cxx
diff options
context:
space:
mode:
authorKen Martin <ken.martin@kitware.com>2002-08-16 11:20:18 -0400
committerKen Martin <ken.martin@kitware.com>2002-08-16 11:20:18 -0400
commit7b5a8762c6d5f7915db99e2344d169d14a4fda65 (patch)
tree4c5294710e7c720afde51e8e7170a39895d17c41 /Source/cmSetSourceFilesPropertiesCommand.cxx
parentf7b1a90256a3e7d94cbb58b595eee5190e8958ba (diff)
downloadcmake-7b5a8762c6d5f7915db99e2344d169d14a4fda65.tar.gz
modified how source files store properties
Diffstat (limited to 'Source/cmSetSourceFilesPropertiesCommand.cxx')
-rw-r--r--Source/cmSetSourceFilesPropertiesCommand.cxx91
1 files changed, 60 insertions, 31 deletions
diff --git a/Source/cmSetSourceFilesPropertiesCommand.cxx b/Source/cmSetSourceFilesPropertiesCommand.cxx
index f065b455aa..a87938618a 100644
--- a/Source/cmSetSourceFilesPropertiesCommand.cxx
+++ b/Source/cmSetSourceFilesPropertiesCommand.cxx
@@ -17,8 +17,8 @@
#include "cmSetSourceFilesPropertiesCommand.h"
// cmSetSourceFilesPropertiesCommand
-bool cmSetSourceFilesPropertiesCommand::InitialPass(std::vector<std::string> const&
- argsIn)
+bool cmSetSourceFilesPropertiesCommand::InitialPass(
+ std::vector<std::string> const& argsIn)
{
if(argsIn.size() < 2 )
{
@@ -28,70 +28,99 @@ bool cmSetSourceFilesPropertiesCommand::InitialPass(std::vector<std::string> con
std::vector<std::string> args;
cmSystemTools::ExpandListArguments(argsIn, args);
+ // first collect up the list of files
+ std::vector<std::string> propertyPairs;
+ bool doingFiles = true;
+ int numFiles = 0;
std::vector<std::string>::const_iterator j;
- // first collect up all the flags that need to be set on the file
- bool abstract = false;
- bool wrap_exclude = false;
- bool generated = false;
- std::string flags;
for(j= args.begin(); j != args.end();++j)
{
+ // old style allows for specifier before PROPERTIES keyword
if(*j == "ABSTRACT")
{
- abstract = true;
+ doingFiles = false;
+ propertyPairs.push_back("ABSTRACT");
+ propertyPairs.push_back("1");
}
else if(*j == "WRAP_EXCLUDE")
{
- wrap_exclude = true;
+ doingFiles = false;
+ propertyPairs.push_back("WRAP_EXCLUDE");
+ propertyPairs.push_back("1");
}
else if(*j == "GENERATED")
{
- generated = true;
+ doingFiles = false;
+ propertyPairs.push_back("GENERATED");
+ propertyPairs.push_back("1");
}
else if(*j == "COMPILE_FLAGS")
{
+ doingFiles = false;
+ propertyPairs.push_back("COMPILE_FLAGS");
++j;
if(j == args.end())
{
- this->SetError("called with incorrect number of arguments FLAGS with no flags");
- return false;
+ this->SetError("called with incorrect number of arguments COMPILE_FLAGS with no flags");
+ return false;
}
- flags = *j;
+ propertyPairs.push_back(*j);
+ }
+ else if(*j == "PROPERTIES")
+ {
+ doingFiles = false;
+ // now loop through the rest of the arguments, new style
+ ++j;
+ while (j != args.end())
+ {
+ propertyPairs.push_back(*j);
+ ++j;
+ if(j == args.end())
+ {
+ this->SetError("called with incorrect number of arguments.");
+ return false;
+ }
+ propertyPairs.push_back(*j);
+ ++j;
+ }
+ }
+ else if (doingFiles)
+ {
+ numFiles++;
+ }
+ else
+ {
+ this->SetError("called with illegal arguments, maybe missing a PROPERTIES specifier?");
+ return false;
}
}
+
// now loop over all the files
- for(j = args.begin(); j != args.end(); ++j)
+ int i, k;
+ for(i = 0; i < numFiles; ++i)
{
- // at the sign of the first property exit the loop
- if(*j == "ABSTRACT" || *j == "WRAP_EXCLUDE" || *j == "COMPILE_FLAGS")
- {
- break;
- }
// if the file is already in the makefile just set properites on it
- cmSourceFile* sf = m_Makefile->GetSource(j->c_str());
+ cmSourceFile* sf = m_Makefile->GetSource(args[i].c_str());
if(sf)
{
- if(flags.size())
+ // now loop through all the props and set them
+ for (k = 0; k < propertyPairs.size(); k = k + 2)
{
- sf->SetCompileFlags(flags.c_str());
+ sf->SetProperty(propertyPairs[k].c_str(),propertyPairs[k+1].c_str());
}
- sf->SetIsAnAbstractClass(abstract);
- sf->SetWrapExclude(wrap_exclude);
}
// if file is not already in the makefile, then add it
else
{
- std::string newfile = *j;
+ std::string newfile = args[i];
cmSourceFile file;
std::string path = cmSystemTools::GetFilenamePath(newfile);
- // set the flags
- file.SetIsAnAbstractClass(abstract);
- file.SetWrapExclude(wrap_exclude);
- if(flags.size())
+ // now loop through all the props and set them
+ for (k = 0; k < propertyPairs.size(); k = k + 2)
{
- file.SetCompileFlags(flags.c_str());
+ file.SetProperty(propertyPairs[k].c_str(),propertyPairs[k+1].c_str());
}
- if(generated)
+ if(file.GetPropertyAsBool("GENERATED"))
{
std::string ext = cmSystemTools::GetFilenameExtension(newfile);
std::string name_no_ext = cmSystemTools::GetFilenameName(newfile.c_str());