ENH: make sure GUIDs for filters are cached

This commit is contained in:
Bill Hoffman 2009-07-17 10:05:54 -04:00
parent 1be805609c
commit 300514fd25
4 changed files with 35 additions and 15 deletions

View File

@ -259,7 +259,9 @@ public:
bool BinaryDirectoryIsNew(const char* dir)
{
return this->BinaryDirectories.insert(dir).second;
}
}
/** Supported systems creates a GUID for the given name */
virtual void CreateGUID(const char*) {}
protected:
// for a project collect all its targets by following depend

View File

@ -69,7 +69,6 @@ public:
const char* GetUtilityForTarget(cmTarget& target, const char*);
protected:
virtual void CreateGUID(const char*) {}
void FixUtilityDepends();
// Does this VS version link targets to each other if there are

View File

@ -43,8 +43,7 @@
cmLocalGenerator::cmLocalGenerator()
{
this->Makefile = new cmMakefile;
this->Makefile->SetLocalGenerator(this);
this->Makefile = 0; // moved to after set on global
this->Parent = 0;
this->WindowsShell = false;
this->WindowsVSIDE = false;
@ -173,6 +172,8 @@ void cmLocalGenerator::SetupPathConversions()
void cmLocalGenerator::SetGlobalGenerator(cmGlobalGenerator *gg)
{
this->GlobalGenerator = gg;
this->Makefile = new cmMakefile;
this->Makefile->SetLocalGenerator(this);
// setup the home directories
this->Makefile->GetProperties().SetCMakeInstance(gg->GetCMakeInstance());

View File

@ -80,17 +80,6 @@ cmMakefile::cmMakefile()
this->DefineFlags = " ";
this->LocalGenerator = 0;
#if defined(CMAKE_BUILD_WITH_CMAKE)
this->AddSourceGroup("", "^.*$");
this->AddSourceGroup
("Source Files",
"\\.(C|M|c|c\\+\\+|cc|cpp|cxx|f|f90|for|fpp"
"|ftn|m|mm|rc|def|r|odl|idl|hpj|bat)$");
this->AddSourceGroup("Header Files",
"\\.(h|hh|h\\+\\+|hm|hpp|hxx|in|txx|inl)$");
this->AddSourceGroup("CMake Rules", "\\.rule$");
this->AddSourceGroup("Resources", "\\.plist$");
#endif
this->AddDefaultDefinitions();
this->Initialize();
this->PreOrder = false;
@ -755,6 +744,20 @@ void cmMakefile::AddCommand(cmCommand* wg)
void cmMakefile::SetLocalGenerator(cmLocalGenerator* lg)
{
this->LocalGenerator = lg;
// the source groups need to access the global generator
// so don't create them until the lg is set
#if defined(CMAKE_BUILD_WITH_CMAKE)
this->AddSourceGroup("", "^.*$");
this->AddSourceGroup
("Source Files",
"\\.(C|M|c|c\\+\\+|cc|cpp|cxx|f|f90|for|fpp"
"|ftn|m|mm|rc|def|r|odl|idl|hpj|bat)$");
this->AddSourceGroup("Header Files",
"\\.(h|hh|h\\+\\+|hm|hpp|hxx|in|txx|inl)$");
this->AddSourceGroup("CMake Rules", "\\.rule$");
this->AddSourceGroup("Resources", "\\.plist$");
#endif
}
bool cmMakefile::NeedBackwardsCompatibility(unsigned int major,
@ -1956,10 +1959,25 @@ void cmMakefile::AddSourceGroup(const std::vector<std::string>& name,
}
// build the whole source group path
const char* fullname = sg->GetFullName();
cmGlobalGenerator* gg = this->LocalGenerator->GetGlobalGenerator();
if(strlen(fullname))
{
std::string guidName = "SG_Filter_";
guidName += fullname;
gg->CreateGUID(guidName.c_str());
}
for(++i; i<=lastElement; ++i)
{
sg->AddChild(cmSourceGroup(name[i].c_str(), 0, sg->GetFullName()));
sg = sg->lookupChild(name[i].c_str());
fullname = sg->GetFullName();
if(strlen(fullname))
{
std::string guidName = "SG_Filter_";
guidName += fullname;
gg->CreateGUID(guidName.c_str());
}
}
sg->SetGroupRegex(regex);