BUG: make sure global generate is done when cmakelist file chagnes, also make sure guids are stored in the cache so the .sln file does not change every time
This commit is contained in:
parent
44803a00c5
commit
70eaddbf8e
@ -18,6 +18,7 @@
|
|||||||
#define cmGeneratedFileStream_h
|
#define cmGeneratedFileStream_h
|
||||||
|
|
||||||
#include "cmStandardIncludes.h"
|
#include "cmStandardIncludes.h"
|
||||||
|
#include "cmSystemTools.h"
|
||||||
|
|
||||||
/** \class cmGeneratedFileStream
|
/** \class cmGeneratedFileStream
|
||||||
* \brief Output stream for generated files that does copy-if-different.
|
* \brief Output stream for generated files that does copy-if-different.
|
||||||
|
@ -231,7 +231,7 @@ void cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout,
|
|||||||
fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \""
|
fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \""
|
||||||
<< dspname << "\", \""
|
<< dspname << "\", \""
|
||||||
<< d << "\\" << dspname << ".vcproj\", \"{"
|
<< d << "\\" << dspname << ".vcproj\", \"{"
|
||||||
<< this->CreateGUID(dspname) << "}\"\n";
|
<< this->GetGUID(dspname) << "}\"\n";
|
||||||
fout << "\tProjectSection(ProjectDependencies) = postProject\n";
|
fout << "\tProjectSection(ProjectDependencies) = postProject\n";
|
||||||
this->WriteProjectDepends(fout, dspname, dir, t);
|
this->WriteProjectDepends(fout, dspname, dir, t);
|
||||||
fout << "\tEndProjectSection\n";
|
fout << "\tEndProjectSection\n";
|
||||||
@ -266,8 +266,8 @@ void cmGlobalVisualStudio71Generator::WriteProjectDepends(std::ostream& fout,
|
|||||||
= m_CMakeInstance->GetCacheDefinition(libPath.c_str());
|
= m_CMakeInstance->GetCacheDefinition(libPath.c_str());
|
||||||
if(cacheValue && *cacheValue)
|
if(cacheValue && *cacheValue)
|
||||||
{
|
{
|
||||||
fout << "\t\t{" << this->CreateGUID(j->first.c_str()) << "} = {"
|
fout << "\t\t{" << this->GetGUID(j->first.c_str()) << "} = {"
|
||||||
<< this->CreateGUID(j->first.c_str()) << "}\n";
|
<< this->GetGUID(j->first.c_str()) << "}\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -281,8 +281,8 @@ void cmGlobalVisualStudio71Generator::WriteProjectDepends(std::ostream& fout,
|
|||||||
{
|
{
|
||||||
if(*i != dspname)
|
if(*i != dspname)
|
||||||
{
|
{
|
||||||
fout << "\t\t{" << this->CreateGUID(i->c_str()) << "} = {"
|
fout << "\t\t{" << this->GetGUID(i->c_str()) << "} = {"
|
||||||
<< this->CreateGUID(i->c_str()) << "}\n";
|
<< this->GetGUID(i->c_str()) << "}\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -296,7 +296,7 @@ cmGlobalVisualStudio71Generator::WriteProjectConfigurations(std::ostream& fout,
|
|||||||
const char* name,
|
const char* name,
|
||||||
bool in_all_build)
|
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();
|
for(std::vector<std::string>::iterator i = m_Configurations.begin();
|
||||||
i != m_Configurations.end(); ++i)
|
i != m_Configurations.end(); ++i)
|
||||||
{
|
{
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
=========================================================================*/
|
=========================================================================*/
|
||||||
#include "cmGlobalVisualStudio7Generator.h"
|
#include "cmGlobalVisualStudio7Generator.h"
|
||||||
#include "cmLocalVisualStudio7Generator.h"
|
#include "cmLocalVisualStudio7Generator.h"
|
||||||
|
#include "cmGeneratedFileStream.h"
|
||||||
#include "cmMakefile.h"
|
#include "cmMakefile.h"
|
||||||
#include "cmake.h"
|
#include "cmake.h"
|
||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
@ -285,14 +286,14 @@ void cmGlobalVisualStudio7Generator::OutputSLNFile(cmLocalGenerator* root,
|
|||||||
fname += "/";
|
fname += "/";
|
||||||
fname += root->GetMakefile()->GetProjectName();
|
fname += root->GetMakefile()->GetProjectName();
|
||||||
fname += ".sln";
|
fname += ".sln";
|
||||||
std::ofstream fout(fname.c_str());
|
cmGeneratedFileStream fout(fname.c_str());
|
||||||
if(!fout)
|
if(!fout)
|
||||||
{
|
{
|
||||||
cmSystemTools::Error("Error can not open DSW file for write: ",
|
cmSystemTools::Error("Error can not open DSW file for write: ",
|
||||||
fname.c_str());
|
fname.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this->WriteSLNFile(fout, root, generators);
|
this->WriteSLNFile(fout.GetStream(), root, generators);
|
||||||
}
|
}
|
||||||
|
|
||||||
// output the SLN file
|
// output the SLN file
|
||||||
@ -528,7 +529,7 @@ void cmGlobalVisualStudio7Generator::WriteProject(std::ostream& fout,
|
|||||||
fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \""
|
fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \""
|
||||||
<< dspname << "\", \""
|
<< dspname << "\", \""
|
||||||
<< d << "\\" << dspname << ".vcproj\", \"{"
|
<< 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());
|
= m_CMakeInstance->GetCacheDefinition(libPath.c_str());
|
||||||
if(cacheValue && *cacheValue)
|
if(cacheValue && *cacheValue)
|
||||||
{
|
{
|
||||||
fout << "\t\t{" << this->CreateGUID(dspname) << "}." << depcount << " = {"
|
fout << "\t\t{" << this->GetGUID(dspname) << "}." << depcount << " = {"
|
||||||
<< this->CreateGUID(j->first.c_str()) << "}\n";
|
<< this->GetGUID(j->first.c_str()) << "}\n";
|
||||||
depcount++;
|
depcount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -575,8 +576,8 @@ void cmGlobalVisualStudio7Generator::WriteProjectDepends(std::ostream& fout,
|
|||||||
{
|
{
|
||||||
if(*i != dspname)
|
if(*i != dspname)
|
||||||
{
|
{
|
||||||
fout << "\t\t{" << this->CreateGUID(dspname) << "}." << depcount << " = {"
|
fout << "\t\t{" << this->GetGUID(dspname) << "}." << depcount << " = {"
|
||||||
<< this->CreateGUID(i->c_str()) << "}\n";
|
<< this->GetGUID(i->c_str()) << "}\n";
|
||||||
depcount++;
|
depcount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -591,7 +592,7 @@ cmGlobalVisualStudio7Generator::WriteProjectConfigurations(std::ostream& fout,
|
|||||||
const char* name,
|
const char* name,
|
||||||
bool in_all_build)
|
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();
|
for(std::vector<std::string>::iterator i = m_Configurations.begin();
|
||||||
i != m_Configurations.end(); ++i)
|
i != m_Configurations.end(); ++i)
|
||||||
{
|
{
|
||||||
@ -617,7 +618,7 @@ void cmGlobalVisualStudio7Generator::WriteExternalProject(std::ostream& fout,
|
|||||||
fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \""
|
fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \""
|
||||||
<< name << "\", \""
|
<< name << "\", \""
|
||||||
<< d << "\", \"{"
|
<< 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";
|
fout << "Microsoft Visual Studio Solution File, Format Version 7.00\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string cmGlobalVisualStudio7Generator::GetGUID(const char* name)
|
||||||
std::string cmGlobalVisualStudio7Generator::CreateGUID(const char* name)
|
|
||||||
{
|
{
|
||||||
std::map<cmStdString, cmStdString>::iterator i = m_GUIDMap.find(name);
|
std::string guidStoreName = name;
|
||||||
if(i != m_GUIDMap.end())
|
guidStoreName += "_GUID_CMAKE";
|
||||||
|
const char* storedGUID = m_CMakeInstance->GetCacheDefinition(guidStoreName.c_str());
|
||||||
|
if(storedGUID)
|
||||||
{
|
{
|
||||||
return i->second;
|
return std::string(storedGUID);
|
||||||
|
}
|
||||||
|
cmSystemTools::Error("Internal CMake Error, Could not find GUID for target: ",
|
||||||
|
name);
|
||||||
|
return guidStoreName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void cmGlobalVisualStudio7Generator::CreateGUID(const char* name)
|
||||||
|
{
|
||||||
|
std::string guidStoreName = name;
|
||||||
|
guidStoreName += "_GUID_CMAKE";
|
||||||
|
if(m_CMakeInstance->GetCacheDefinition(guidStoreName.c_str()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
std::string ret;
|
std::string ret;
|
||||||
UUID uid;
|
UUID uid;
|
||||||
@ -655,8 +671,8 @@ std::string cmGlobalVisualStudio7Generator::CreateGUID(const char* name)
|
|||||||
ret = reinterpret_cast<char*>(uidstr);
|
ret = reinterpret_cast<char*>(uidstr);
|
||||||
RpcStringFree(&uidstr);
|
RpcStringFree(&uidstr);
|
||||||
ret = cmSystemTools::UpperCase(ret);
|
ret = cmSystemTools::UpperCase(ret);
|
||||||
m_GUIDMap[name] = ret;
|
m_CMakeInstance->AddCacheEntry(guidStoreName.c_str(), ret.c_str(), "Stored GUID",
|
||||||
return ret;
|
cmCacheManager::INTERNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmGlobalVisualStudio7Generator::LocalGenerate()
|
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");
|
||||||
|
}
|
||||||
|
@ -80,8 +80,14 @@ public:
|
|||||||
* Get the list of configurations
|
* Get the list of configurations
|
||||||
*/
|
*/
|
||||||
std::vector<std::string> *GetConfigurations();
|
std::vector<std::string> *GetConfigurations();
|
||||||
|
|
||||||
|
///! Create a GUID
|
||||||
|
void CreateGUID(const char* name);
|
||||||
|
|
||||||
|
///! do configure step
|
||||||
|
virtual void Configure();
|
||||||
protected:
|
protected:
|
||||||
|
std::string GetGUID(const char* name);
|
||||||
void CollectSubprojects();
|
void CollectSubprojects();
|
||||||
virtual void OutputSLNFile(cmLocalGenerator* root,
|
virtual void OutputSLNFile(cmLocalGenerator* root,
|
||||||
std::vector<cmLocalGenerator*>& generators);
|
std::vector<cmLocalGenerator*>& generators);
|
||||||
@ -103,7 +109,6 @@ protected:
|
|||||||
void WriteExternalProject(std::ostream& fout,
|
void WriteExternalProject(std::ostream& fout,
|
||||||
const char* name, const char* path,
|
const char* name, const char* path,
|
||||||
const std::vector<std::string>& dependencies);
|
const std::vector<std::string>& dependencies);
|
||||||
std::string CreateGUID(const char* name);
|
|
||||||
|
|
||||||
std::vector<std::string> m_Configurations;
|
std::vector<std::string> m_Configurations;
|
||||||
std::map<cmStdString, cmStdString> m_GUIDMap;
|
std::map<cmStdString, cmStdString> m_GUIDMap;
|
||||||
|
@ -178,11 +178,6 @@ void cmLocalVisualStudio6Generator::AddDSPBuildRule()
|
|||||||
args +=
|
args +=
|
||||||
this->ConvertToRelativeOutputPath(m_Makefile->GetHomeDirectory());
|
this->ConvertToRelativeOutputPath(m_Makefile->GetHomeDirectory());
|
||||||
argv.push_back(args);
|
argv.push_back(args);
|
||||||
args = "-S";
|
|
||||||
args +=
|
|
||||||
this->ConvertToRelativeOutputPath(m_Makefile->GetStartDirectory());
|
|
||||||
argv.push_back(args);
|
|
||||||
args = "-O";
|
|
||||||
args +=
|
args +=
|
||||||
this->ConvertToRelativeOutputPath(m_Makefile->GetStartOutputDirectory());
|
this->ConvertToRelativeOutputPath(m_Makefile->GetStartOutputDirectory());
|
||||||
argv.push_back(args);
|
argv.push_back(args);
|
||||||
|
@ -151,14 +151,6 @@ void cmLocalVisualStudio7Generator::AddVCProjBuildRule()
|
|||||||
args +=
|
args +=
|
||||||
this->ConvertToRelativeOutputPath(m_Makefile->GetHomeDirectory());
|
this->ConvertToRelativeOutputPath(m_Makefile->GetHomeDirectory());
|
||||||
argv.push_back(args);
|
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 = "-B";
|
||||||
args +=
|
args +=
|
||||||
this->ConvertToRelativeOutputPath(m_Makefile->GetHomeOutputDirectory());
|
this->ConvertToRelativeOutputPath(m_Makefile->GetHomeOutputDirectory());
|
||||||
@ -1237,4 +1229,17 @@ std::string cmLocalVisualStudio7Generator::ConvertToXMLOutputPathSingle(const ch
|
|||||||
return ret;
|
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());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ public:
|
|||||||
return m_CreatedProjectNames;
|
return m_CreatedProjectNames;
|
||||||
}
|
}
|
||||||
void SetVersion71() {m_Version71 = true;}
|
void SetVersion71() {m_Version71 = true;}
|
||||||
|
virtual void ConfigureFinalPass();
|
||||||
private:
|
private:
|
||||||
void OutputVCProjFile();
|
void OutputVCProjFile();
|
||||||
void WriteVCProjHeader(std::ostream& fout, const char *libName,
|
void WriteVCProjHeader(std::ostream& fout, const char *libName,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user