diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2009-07-17 14:05:54 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2009-07-17 14:05:54 (GMT) |
commit | 300514fd254579b69fdac6e9edd6e9415026305e (patch) | |
tree | 9e902c93f9b63551edf6fbcc243638698b5fd9f0 | |
parent | 1be805609c8c350fe4a1cdc41a85ac0ff3947410 (diff) | |
download | CMake-300514fd254579b69fdac6e9edd6e9415026305e.zip CMake-300514fd254579b69fdac6e9edd6e9415026305e.tar.gz CMake-300514fd254579b69fdac6e9edd6e9415026305e.tar.bz2 |
ENH: make sure GUIDs for filters are cached
-rw-r--r-- | Source/cmGlobalGenerator.h | 4 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudioGenerator.h | 1 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 5 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 40 |
4 files changed, 35 insertions, 15 deletions
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 4df2d39..914e1da 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -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 diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index 408118a..e7b8e46 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -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 diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 67fa280..fcbb566 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -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()); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 3451c4d..5edbaa6 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -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); |