|
@@ -17,8 +17,8 @@
|
|
|
#include "cmSetSourceFilesPropertiesCommand.h"
|
|
#include "cmSetSourceFilesPropertiesCommand.h"
|
|
|
|
|
|
|
|
// cmSetSourceFilesPropertiesCommand
|
|
// cmSetSourceFilesPropertiesCommand
|
|
|
-bool cmSetSourceFilesPropertiesCommand::InitialPass(std::vector<std::string> const&
|
|
|
|
|
- argsIn)
|
|
|
|
|
|
|
+bool cmSetSourceFilesPropertiesCommand::InitialPass(
|
|
|
|
|
+ std::vector<std::string> const& argsIn)
|
|
|
{
|
|
{
|
|
|
if(argsIn.size() < 2 )
|
|
if(argsIn.size() < 2 )
|
|
|
{
|
|
{
|
|
@@ -28,70 +28,99 @@ bool cmSetSourceFilesPropertiesCommand::InitialPass(std::vector<std::string> con
|
|
|
std::vector<std::string> args;
|
|
std::vector<std::string> args;
|
|
|
cmSystemTools::ExpandListArguments(argsIn, 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;
|
|
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)
|
|
for(j= args.begin(); j != args.end();++j)
|
|
|
{
|
|
{
|
|
|
|
|
+ // old style allows for specifier before PROPERTIES keyword
|
|
|
if(*j == "ABSTRACT")
|
|
if(*j == "ABSTRACT")
|
|
|
{
|
|
{
|
|
|
- abstract = true;
|
|
|
|
|
|
|
+ doingFiles = false;
|
|
|
|
|
+ propertyPairs.push_back("ABSTRACT");
|
|
|
|
|
+ propertyPairs.push_back("1");
|
|
|
}
|
|
}
|
|
|
else if(*j == "WRAP_EXCLUDE")
|
|
else if(*j == "WRAP_EXCLUDE")
|
|
|
{
|
|
{
|
|
|
- wrap_exclude = true;
|
|
|
|
|
|
|
+ doingFiles = false;
|
|
|
|
|
+ propertyPairs.push_back("WRAP_EXCLUDE");
|
|
|
|
|
+ propertyPairs.push_back("1");
|
|
|
}
|
|
}
|
|
|
else if(*j == "GENERATED")
|
|
else if(*j == "GENERATED")
|
|
|
{
|
|
{
|
|
|
- generated = true;
|
|
|
|
|
|
|
+ doingFiles = false;
|
|
|
|
|
+ propertyPairs.push_back("GENERATED");
|
|
|
|
|
+ propertyPairs.push_back("1");
|
|
|
}
|
|
}
|
|
|
else if(*j == "COMPILE_FLAGS")
|
|
else if(*j == "COMPILE_FLAGS")
|
|
|
{
|
|
{
|
|
|
|
|
+ doingFiles = false;
|
|
|
|
|
+ propertyPairs.push_back("COMPILE_FLAGS");
|
|
|
++j;
|
|
++j;
|
|
|
if(j == args.end())
|
|
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
|
|
// 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
|
|
// 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(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
|
|
// if file is not already in the makefile, then add it
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
- std::string newfile = *j;
|
|
|
|
|
|
|
+ std::string newfile = args[i];
|
|
|
cmSourceFile file;
|
|
cmSourceFile file;
|
|
|
std::string path = cmSystemTools::GetFilenamePath(newfile);
|
|
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 ext = cmSystemTools::GetFilenameExtension(newfile);
|
|
|
std::string name_no_ext = cmSystemTools::GetFilenameName(newfile.c_str());
|
|
std::string name_no_ext = cmSystemTools::GetFilenameName(newfile.c_str());
|