diff options
-rw-r--r-- | Source/cmGeneratedFileStream.h | 1 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio71Generator.cxx | 12 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio7Generator.cxx | 55 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio7Generator.h | 9 | ||||
-rw-r--r-- | Source/cmLocalVisualStudio6Generator.cxx | 5 | ||||
-rw-r--r-- | Source/cmLocalVisualStudio7Generator.cxx | 21 | ||||
-rw-r--r-- | Source/cmLocalVisualStudio7Generator.h | 2 |
7 files changed, 68 insertions, 37 deletions
diff --git a/Source/cmGeneratedFileStream.h b/Source/cmGeneratedFileStream.h index e713289..97ef705 100644 --- a/Source/cmGeneratedFileStream.h +++ b/Source/cmGeneratedFileStream.h @@ -18,6 +18,7 @@ #define cmGeneratedFileStream_h #include "cmStandardIncludes.h" +#include "cmSystemTools.h" /** \class cmGeneratedFileStream * \brief Output stream for generated files that does copy-if-different. diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index 11d6cd7..bfcbe8c 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -231,7 +231,7 @@ void cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout, fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"" << dspname << "\", \"" << d << "\\" << dspname << ".vcproj\", \"{" - << this->CreateGUID(dspname) << "}\"\n"; + << this->GetGUID(dspname) << "}\"\n"; fout << "\tProjectSection(ProjectDependencies) = postProject\n"; this->WriteProjectDepends(fout, dspname, dir, t); fout << "\tEndProjectSection\n"; @@ -266,8 +266,8 @@ void cmGlobalVisualStudio71Generator::WriteProjectDepends(std::ostream& fout, = m_CMakeInstance->GetCacheDefinition(libPath.c_str()); if(cacheValue && *cacheValue) { - fout << "\t\t{" << this->CreateGUID(j->first.c_str()) << "} = {" - << this->CreateGUID(j->first.c_str()) << "}\n"; + fout << "\t\t{" << this->GetGUID(j->first.c_str()) << "} = {" + << this->GetGUID(j->first.c_str()) << "}\n"; } } } @@ -281,8 +281,8 @@ void cmGlobalVisualStudio71Generator::WriteProjectDepends(std::ostream& fout, { if(*i != dspname) { - fout << "\t\t{" << this->CreateGUID(i->c_str()) << "} = {" - << this->CreateGUID(i->c_str()) << "}\n"; + fout << "\t\t{" << this->GetGUID(i->c_str()) << "} = {" + << this->GetGUID(i->c_str()) << "}\n"; } } } @@ -296,7 +296,7 @@ cmGlobalVisualStudio71Generator::WriteProjectConfigurations(std::ostream& fout, const char* name, bool in_all_build) { - std::string guid = this->CreateGUID(name); + std::string guid = this->GetGUID(name); for(std::vector<std::string>::iterator i = m_Configurations.begin(); i != m_Configurations.end(); ++i) { diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 5e4e44e..7935f2c 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -16,6 +16,7 @@ =========================================================================*/ #include "cmGlobalVisualStudio7Generator.h" #include "cmLocalVisualStudio7Generator.h" +#include "cmGeneratedFileStream.h" #include "cmMakefile.h" #include "cmake.h" #include "windows.h" @@ -285,14 +286,14 @@ void cmGlobalVisualStudio7Generator::OutputSLNFile(cmLocalGenerator* root, fname += "/"; fname += root->GetMakefile()->GetProjectName(); fname += ".sln"; - std::ofstream fout(fname.c_str()); + cmGeneratedFileStream fout(fname.c_str()); if(!fout) { cmSystemTools::Error("Error can not open DSW file for write: ", fname.c_str()); return; } - this->WriteSLNFile(fout, root, generators); + this->WriteSLNFile(fout.GetStream(), root, generators); } // output the SLN file @@ -528,7 +529,7 @@ void cmGlobalVisualStudio7Generator::WriteProject(std::ostream& fout, fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"" << dspname << "\", \"" << d << "\\" << dspname << ".vcproj\", \"{" - << this->CreateGUID(dspname) << "}\"\nEndProject\n"; + << this->GetGUID(dspname) << "}\"\nEndProject\n"; } @@ -559,8 +560,8 @@ void cmGlobalVisualStudio7Generator::WriteProjectDepends(std::ostream& fout, = m_CMakeInstance->GetCacheDefinition(libPath.c_str()); if(cacheValue && *cacheValue) { - fout << "\t\t{" << this->CreateGUID(dspname) << "}." << depcount << " = {" - << this->CreateGUID(j->first.c_str()) << "}\n"; + fout << "\t\t{" << this->GetGUID(dspname) << "}." << depcount << " = {" + << this->GetGUID(j->first.c_str()) << "}\n"; depcount++; } } @@ -575,8 +576,8 @@ void cmGlobalVisualStudio7Generator::WriteProjectDepends(std::ostream& fout, { if(*i != dspname) { - fout << "\t\t{" << this->CreateGUID(dspname) << "}." << depcount << " = {" - << this->CreateGUID(i->c_str()) << "}\n"; + fout << "\t\t{" << this->GetGUID(dspname) << "}." << depcount << " = {" + << this->GetGUID(i->c_str()) << "}\n"; depcount++; } } @@ -591,7 +592,7 @@ cmGlobalVisualStudio7Generator::WriteProjectConfigurations(std::ostream& fout, const char* name, bool in_all_build) { - std::string guid = this->CreateGUID(name); + std::string guid = this->GetGUID(name); for(std::vector<std::string>::iterator i = m_Configurations.begin(); i != m_Configurations.end(); ++i) { @@ -617,7 +618,7 @@ void cmGlobalVisualStudio7Generator::WriteExternalProject(std::ostream& fout, fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"" << name << "\", \"" << d << "\", \"{" - << this->CreateGUID(name) << "}\"\nEndProject\n"; + << this->GetGUID(name) << "}\"\nEndProject\n"; } @@ -639,13 +640,28 @@ void cmGlobalVisualStudio7Generator::WriteSLNHeader(std::ostream& fout) fout << "Microsoft Visual Studio Solution File, Format Version 7.00\n"; } +std::string cmGlobalVisualStudio7Generator::GetGUID(const char* name) +{ + std::string guidStoreName = name; + guidStoreName += "_GUID_CMAKE"; + const char* storedGUID = m_CMakeInstance->GetCacheDefinition(guidStoreName.c_str()); + if(storedGUID) + { + return std::string(storedGUID); + } + cmSystemTools::Error("Internal CMake Error, Could not find GUID for target: ", + name); + return guidStoreName; +} + -std::string cmGlobalVisualStudio7Generator::CreateGUID(const char* name) +void cmGlobalVisualStudio7Generator::CreateGUID(const char* name) { - std::map<cmStdString, cmStdString>::iterator i = m_GUIDMap.find(name); - if(i != m_GUIDMap.end()) + std::string guidStoreName = name; + guidStoreName += "_GUID_CMAKE"; + if(m_CMakeInstance->GetCacheDefinition(guidStoreName.c_str())) { - return i->second; + return; } std::string ret; UUID uid; @@ -655,8 +671,8 @@ std::string cmGlobalVisualStudio7Generator::CreateGUID(const char* name) ret = reinterpret_cast<char*>(uidstr); RpcStringFree(&uidstr); ret = cmSystemTools::UpperCase(ret); - m_GUIDMap[name] = ret; - return ret; + m_CMakeInstance->AddCacheEntry(guidStoreName.c_str(), ret.c_str(), "Stored GUID", + cmCacheManager::INTERNAL); } void cmGlobalVisualStudio7Generator::LocalGenerate() @@ -693,3 +709,12 @@ void cmGlobalVisualStudio7Generator::CollectSubprojects() } } } + +// make sure "special" targets have GUID's +void cmGlobalVisualStudio7Generator::Configure() +{ + cmGlobalGenerator::Configure(); + this->CreateGUID("ALL_BUILD"); + this->CreateGUID("INSTALL"); + this->CreateGUID("RUN_TESTS"); +} diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index d934ebe..50e6984 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -80,8 +80,14 @@ public: * Get the list of configurations */ std::vector<std::string> *GetConfigurations(); - + + ///! Create a GUID + void CreateGUID(const char* name); + + ///! do configure step + virtual void Configure(); protected: + std::string GetGUID(const char* name); void CollectSubprojects(); virtual void OutputSLNFile(cmLocalGenerator* root, std::vector<cmLocalGenerator*>& generators); @@ -103,7 +109,6 @@ protected: void WriteExternalProject(std::ostream& fout, const char* name, const char* path, const std::vector<std::string>& dependencies); - std::string CreateGUID(const char* name); std::vector<std::string> m_Configurations; std::map<cmStdString, cmStdString> m_GUIDMap; diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index bc9fe68..84df938 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -178,11 +178,6 @@ void cmLocalVisualStudio6Generator::AddDSPBuildRule() args += this->ConvertToRelativeOutputPath(m_Makefile->GetHomeDirectory()); argv.push_back(args); - args = "-S"; - args += - this->ConvertToRelativeOutputPath(m_Makefile->GetStartDirectory()); - argv.push_back(args); - args = "-O"; args += this->ConvertToRelativeOutputPath(m_Makefile->GetStartOutputDirectory()); argv.push_back(args); diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 7e526e1..6a6bcd1 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -151,14 +151,6 @@ void cmLocalVisualStudio7Generator::AddVCProjBuildRule() args += this->ConvertToRelativeOutputPath(m_Makefile->GetHomeDirectory()); argv.push_back(args); - args = "-S"; - args += - this->ConvertToRelativeOutputPath(m_Makefile->GetStartDirectory()); - argv.push_back(args); - args = "-O"; - args += - this->ConvertToRelativeOutputPath(m_Makefile->GetStartOutputDirectory()); - argv.push_back(args); args = "-B"; args += this->ConvertToRelativeOutputPath(m_Makefile->GetHomeOutputDirectory()); @@ -1237,4 +1229,17 @@ std::string cmLocalVisualStudio7Generator::ConvertToXMLOutputPathSingle(const ch return ret; } +void cmLocalVisualStudio7Generator::ConfigureFinalPass() +{ + cmLocalGenerator::ConfigureFinalPass(); + cmTargets &tgts = m_Makefile->GetTargets(); + + cmGlobalVisualStudio7Generator* gg = + static_cast<cmGlobalVisualStudio7Generator *>(m_GlobalGenerator); + for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++) + { + gg->CreateGUID(l->first.c_str()); + } + +} diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h index df711b7..3ac9a8f 100644 --- a/Source/cmLocalVisualStudio7Generator.h +++ b/Source/cmLocalVisualStudio7Generator.h @@ -64,7 +64,7 @@ public: return m_CreatedProjectNames; } void SetVersion71() {m_Version71 = true;} - + virtual void ConfigureFinalPass(); private: void OutputVCProjFile(); void WriteVCProjHeader(std::ostream& fout, const char *libName, |