BUG: Fixed generation of VS8 solution file to not be re-written when loaded by VS and to work with msbuild.

This commit is contained in:
Brad King 2006-02-14 15:35:34 -05:00
parent eeab2c55ed
commit bd0b829ffb
5 changed files with 70 additions and 23 deletions

View File

@ -25,6 +25,7 @@
cmGlobalVisualStudio71Generator::cmGlobalVisualStudio71Generator()
{
m_FindMakeProgramFile = "CMakeVS71FindMake.cmake";
m_ProjectConfigurationSectionName = "ProjectConfiguration";
}
@ -52,6 +53,7 @@ void cmGlobalVisualStudio71Generator::WriteSLNFile(std::ostream& fout,
std::string rootdir = root->GetMakefile()->GetStartOutputDirectory();
rootdir += "/";
bool doneAllBuild = false;
bool doneCheckBuild = false;
bool doneRunTests = false;
bool doneInstall = false;
@ -141,6 +143,17 @@ void cmGlobalVisualStudio71Generator::WriteSLNFile(std::ostream& fout,
doneAllBuild = true;
}
}
if(l->first == CMAKE_CHECK_BUILD_SYSTEM_TARGET)
{
if(doneCheckBuild)
{
skip = true;
}
else
{
doneCheckBuild = true;
}
}
if(l->first == "INSTALL")
{
if(doneInstall)
@ -172,16 +185,10 @@ void cmGlobalVisualStudio71Generator::WriteSLNFile(std::ostream& fout,
}
}
}
fout << "Global\n"
<< "\tGlobalSection(SolutionConfiguration) = preSolution\n";
for(std::vector<std::string>::iterator i = m_Configurations.begin();
i != m_Configurations.end(); ++i)
{
fout << "\t\t" << *i << " = " << *i << "\n";
}
fout << "\tEndGlobalSection\n";
fout << "\tGlobalSection(ProjectConfiguration) = postSolution\n";
fout << "Global\n";
this->WriteSolutionConfigurations(fout);
fout << "\tGlobalSection(" << m_ProjectConfigurationSectionName
<< ") = postSolution\n";
// loop over again and compute the depends
for(i = 0; i < generators.size(); ++i)
{
@ -221,6 +228,19 @@ void cmGlobalVisualStudio71Generator::WriteSLNFile(std::ostream& fout,
}
void
cmGlobalVisualStudio71Generator
::WriteSolutionConfigurations(std::ostream& fout)
{
fout << "\tGlobalSection(SolutionConfiguration) = preSolution\n";
for(std::vector<std::string>::iterator i = m_Configurations.begin();
i != m_Configurations.end(); ++i)
{
fout << "\t\t" << *i << " = " << *i << "\n";
}
fout << "\tEndGlobalSection\n";
}
// Write a dsp file into the SLN file,
// Note, that dependencies from executables to
// the libraries it uses are also done here

View File

@ -46,6 +46,7 @@ protected:
virtual void WriteSLNFile(std::ostream& fout,
cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& generators);
virtual void WriteSolutionConfigurations(std::ostream& fout);
virtual void WriteProject(std::ostream& fout,
const char* name, const char* path, cmTarget &t);
virtual void WriteProjectDepends(std::ostream& fout,
@ -55,5 +56,7 @@ protected:
const std::vector<std::string>& depends);
virtual void WriteSLNFooter(std::ostream& fout);
virtual void WriteSLNHeader(std::ostream& fout);
std::string m_ProjectConfigurationSectionName;
};
#endif

View File

@ -278,7 +278,6 @@ void cmGlobalVisualStudio7Generator::WriteSLNFile(std::ostream& fout,
std::string rootdir = root->GetMakefile()->GetStartOutputDirectory();
rootdir += "/";
bool doneAllBuild = false;
bool doneCheckBuild = false;
bool doneRunTests = false;
bool doneInstall = false;
@ -368,17 +367,6 @@ void cmGlobalVisualStudio7Generator::WriteSLNFile(std::ostream& fout,
doneAllBuild = true;
}
}
if(l->first == CMAKE_CHECK_BUILD_SYSTEM_TARGET)
{
if(doneCheckBuild)
{
skip = true;
}
else
{
doneCheckBuild = true;
}
}
if(l->first == "INSTALL")
{
if(doneInstall)

View File

@ -25,6 +25,7 @@
cmGlobalVisualStudio8Generator::cmGlobalVisualStudio8Generator()
{
m_FindMakeProgramFile = "CMakeVS8FindMake.cmake";
m_ProjectConfigurationSectionName = "ProjectConfigurationPlatforms";
}
@ -179,5 +180,37 @@ void cmGlobalVisualStudio8Generator::WriteSLNFile(
}
// Now write the solution file.
this->cmGlobalVisualStudio7Generator::WriteSLNFile(fout, root, generators);
this->cmGlobalVisualStudio71Generator::WriteSLNFile(fout, root, generators);
}
//----------------------------------------------------------------------------
void
cmGlobalVisualStudio8Generator
::WriteSolutionConfigurations(std::ostream& fout)
{
fout << "\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n";
for(std::vector<std::string>::iterator i = m_Configurations.begin();
i != m_Configurations.end(); ++i)
{
fout << "\t\t" << *i << "|Win32 = " << *i << "|Win32\n";
}
fout << "\tEndGlobalSection\n";
}
//----------------------------------------------------------------------------
void
cmGlobalVisualStudio8Generator
::WriteProjectConfigurations(std::ostream& fout,
const char* name, bool in_all_build)
{
std::string guid = this->GetGUID(name);
for(std::vector<std::string>::iterator i = m_Configurations.begin();
i != m_Configurations.end(); ++i)
{
fout << "\t\t{" << guid << "}." << *i << "|Win32.ActiveCfg = " << *i << "|Win32\n";
if (in_all_build)
{
fout << "\t\t{" << guid << "}." << *i << "|Win32.Build.0 = " << *i << "|Win32\n";
}
}
}

View File

@ -52,5 +52,8 @@ protected:
virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& generators);
virtual void WriteSLNHeader(std::ostream& fout);
virtual void WriteSolutionConfigurations(std::ostream& fout);
virtual void WriteProjectConfigurations(std::ostream& fout,
const char* name, bool in_all);
};
#endif