summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmGlobalVisualStudio71Generator.cxx6
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx55
-rw-r--r--Source/cmGlobalVisualStudio7Generator.h17
3 files changed, 52 insertions, 26 deletions
diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx
index 01ea403..6974b07 100644
--- a/Source/cmGlobalVisualStudio71Generator.cxx
+++ b/Source/cmGlobalVisualStudio71Generator.cxx
@@ -115,7 +115,9 @@ void cmGlobalVisualStudio71Generator
this->GetTargetSets(projectTargets,
originalTargets,
root, generators);
- this->WriteTargetsToSolution(fout, root, projectTargets, originalTargets);
+ OrderedTargetDependSet orderedProjectTargets(projectTargets);
+ this->WriteTargetsToSolution(fout, root, orderedProjectTargets,
+ originalTargets);
// Write out the configurations information for the solution
fout << "Global\n";
// Write out the configurations for the solution
@@ -123,7 +125,7 @@ void cmGlobalVisualStudio71Generator
fout << "\tGlobalSection(" << this->ProjectConfigurationSectionName
<< ") = postSolution\n";
// Write out the configurations for all the targets in the project
- this->WriteTargetConfigurations(fout, root, projectTargets);
+ this->WriteTargetConfigurations(fout, root, orderedProjectTargets);
fout << "\tEndGlobalSection\n";
// Write the footer for the SLN file
this->WriteSLNFooter(fout);
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index 37e4a00..b18283c 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -253,15 +253,7 @@ void cmGlobalVisualStudio7Generator::AddAllBuildDepends(
cmTarget* t = const_cast<cmTarget*>(*ot);
if(!this->IsExcluded(root, *t))
{
- if (t->GetType() == cmTarget::UTILITY ||
- t->GetType() == cmTarget::GLOBAL_TARGET)
- {
- target->AddUtility(t->GetName());
- }
- else
- {
- target->AddLinkLibrary(t->GetName(),cmTarget::GENERAL);
- }
+ target->AddUtility(t->GetName());
}
}
}
@@ -269,14 +261,14 @@ void cmGlobalVisualStudio7Generator::AddAllBuildDepends(
void cmGlobalVisualStudio7Generator::WriteTargetConfigurations(
std::ostream& fout,
cmLocalGenerator* root,
- cmGlobalGenerator::TargetDependSet& projectTargets)
+ OrderedTargetDependSet const& projectTargets)
{
// loop over again and write out configurations for each target
// in the solution
- for(cmGlobalGenerator::TargetDependSet::iterator tt =
+ for(OrderedTargetDependSet::const_iterator tt =
projectTargets.begin(); tt != projectTargets.end(); ++tt)
{
- cmTarget* target = const_cast<cmTarget*>(*tt);
+ cmTarget* target = *tt;
if (strncmp(target->GetName(), "INCLUDE_EXTERNAL_MSPROJECT", 26) == 0)
{
cmCustomCommand cc = target->GetPostBuildCommands()[0];
@@ -304,16 +296,16 @@ void cmGlobalVisualStudio7Generator::WriteTargetConfigurations(
void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
std::ostream& fout,
cmLocalGenerator* root,
- cmGlobalGenerator::TargetDependSet& projectTargets,
+ OrderedTargetDependSet const& projectTargets,
cmGlobalGenerator::TargetDependSet& originalTargets
)
{
std::string rootdir = root->GetMakefile()->GetStartOutputDirectory();
rootdir += "/";
- for(cmGlobalGenerator::TargetDependSet::iterator tt =
+ for(OrderedTargetDependSet::const_iterator tt =
projectTargets.begin(); tt != projectTargets.end(); ++tt)
{
- cmTarget* target = const_cast<cmTarget*>(*tt);
+ cmTarget* target = *tt;
cmMakefile* mf = target->GetMakefile();
// look for the all_build rule and add depends to all
// of the original targets (none that were "pulled" into this project)
@@ -370,13 +362,13 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
void cmGlobalVisualStudio7Generator::WriteTargetDepends(
std::ostream& fout,
- cmGlobalGenerator::TargetDependSet& projectTargets
+ OrderedTargetDependSet const& projectTargets
)
{
- for(cmGlobalGenerator::TargetDependSet::iterator tt =
+ for(OrderedTargetDependSet::const_iterator tt =
projectTargets.begin(); tt != projectTargets.end(); ++tt)
{
- cmTarget* target = const_cast<cmTarget*>(*tt);
+ cmTarget* target = *tt;
cmMakefile* mf = target->GetMakefile();
if (strncmp(target->GetName(), "INCLUDE_EXTERNAL_MSPROJECT", 26) == 0)
{
@@ -434,7 +426,9 @@ void cmGlobalVisualStudio7Generator
this->GetTargetSets(projectTargets,
originalTargets,
root, generators);
- this->WriteTargetsToSolution(fout, root, projectTargets, originalTargets);
+ OrderedTargetDependSet orderedProjectTargets(projectTargets);
+ this->WriteTargetsToSolution(fout, root, orderedProjectTargets,
+ originalTargets);
// Write out the configurations information for the solution
fout << "Global\n"
<< "\tGlobalSection(SolutionConfiguration) = preSolution\n";
@@ -449,12 +443,12 @@ void cmGlobalVisualStudio7Generator
fout << "\tEndGlobalSection\n";
// Write out project(target) depends
fout << "\tGlobalSection(ProjectDependencies) = postSolution\n";
- this->WriteTargetDepends(fout, projectTargets);
+ this->WriteTargetDepends(fout, orderedProjectTargets);
fout << "\tEndGlobalSection\n";
// Write out the configurations for all the targets in the project
fout << "\tGlobalSection(ProjectConfiguration) = postSolution\n";
- this->WriteTargetConfigurations(fout, root, projectTargets);
+ this->WriteTargetConfigurations(fout, root, orderedProjectTargets);
fout << "\tEndGlobalSection\n";
// Write the footer for the SLN file
@@ -731,6 +725,25 @@ bool cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(const char* project,
}
//----------------------------------------------------------------------------
+bool
+cmGlobalVisualStudio7Generator::TargetCompare
+::operator()(cmTarget const* l, cmTarget const* r)
+{
+ return strcmp(l->GetName(), r->GetName()) < 0;
+}
+
+//----------------------------------------------------------------------------
+cmGlobalVisualStudio7Generator::OrderedTargetDependSet
+::OrderedTargetDependSet(cmGlobalGenerator::TargetDependSet const& targets)
+{
+ for(cmGlobalGenerator::TargetDependSet::const_iterator ti =
+ targets.begin(); ti != targets.end(); ++ti)
+ {
+ this->insert(*ti);
+ }
+}
+
+//----------------------------------------------------------------------------
static cmVS7FlagTable cmVS7ExtraFlagTable[] =
{
// Precompiled header and related options. Note that the
diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h
index 09bd84e..89698e4 100644
--- a/Source/cmGlobalVisualStudio7Generator.h
+++ b/Source/cmGlobalVisualStudio7Generator.h
@@ -97,6 +97,11 @@ public:
///! What is the configurations directory variable called?
virtual const char* GetCMakeCFGInitDirectory() { return "$(OutDir)"; }
+ struct TargetCompare
+ {
+ bool operator()(cmTarget const* l, cmTarget const* r);
+ };
+
protected:
static cmVS7FlagTable const* GetExtraFlagTableVS7();
virtual void OutputSLNFile(cmLocalGenerator* root,
@@ -114,18 +119,24 @@ protected:
virtual void WriteSLNHeader(std::ostream& fout);
virtual void AddPlatformDefinitions(cmMakefile* mf);
+ class OrderedTargetDependSet: public std::set<cmTarget*, TargetCompare>
+ {
+ public:
+ OrderedTargetDependSet(cmGlobalGenerator::TargetDependSet const&);
+ };
+
virtual void WriteTargetsToSolution(
std::ostream& fout,
cmLocalGenerator* root,
- cmGlobalGenerator::TargetDependSet& projectTargets,
+ OrderedTargetDependSet const& projectTargets,
cmGlobalGenerator::TargetDependSet& originalTargets);
virtual void WriteTargetDepends(
std::ostream& fout,
- cmGlobalGenerator::TargetDependSet& projectTargets);
+ OrderedTargetDependSet const& projectTargets);
virtual void WriteTargetConfigurations(
std::ostream& fout,
cmLocalGenerator* root,
- cmGlobalGenerator::TargetDependSet& projectTargets);
+ OrderedTargetDependSet const& projectTargets);
void AddAllBuildDepends(cmLocalGenerator* root,
cmTarget* target,