[Cmake-commits] [cmake-commits] king committed cmGlobalVisualStudio71Generator.cxx 1.50 1.51 cmGlobalVisualStudio7Generator.cxx 1.102 1.103 cmGlobalVisualStudio7Generator.h 1.45 1.46
cmake-commits at cmake.org
cmake-commits at cmake.org
Wed Jan 21 16:39:45 EST 2009
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv3864/Source
Modified Files:
cmGlobalVisualStudio71Generator.cxx
cmGlobalVisualStudio7Generator.cxx
cmGlobalVisualStudio7Generator.h
Log Message:
BUG: Fix VS IDE project order
Our implementation of the feature to pull in dependent targets in VS
solution files for subprojects caused the order of project files in the
solution to be arbitrary (based on pointer value in the representation).
Target ordering in solution files is important to prevent unnecessary
changing of the files and because the VS IDE selects the first project
listed as the default active target. This change restores lexicographic
order by target name.
Index: cmGlobalVisualStudio71Generator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalVisualStudio71Generator.cxx,v
retrieving revision 1.50
retrieving revision 1.51
diff -C 2 -d -r1.50 -r1.51
*** cmGlobalVisualStudio71Generator.cxx 1 Oct 2008 13:04:27 -0000 1.50
--- cmGlobalVisualStudio71Generator.cxx 21 Jan 2009 21:39:42 -0000 1.51
***************
*** 116,120 ****
originalTargets,
root, generators);
! this->WriteTargetsToSolution(fout, root, projectTargets, originalTargets);
// Write out the configurations information for the solution
fout << "Global\n";
--- 116,122 ----
originalTargets,
root, generators);
! OrderedTargetDependSet orderedProjectTargets(projectTargets);
! this->WriteTargetsToSolution(fout, root, orderedProjectTargets,
! originalTargets);
// Write out the configurations information for the solution
fout << "Global\n";
***************
*** 124,128 ****
<< ") = postSolution\n";
// Write out the configurations for all the targets in the project
! this->WriteTargetConfigurations(fout, root, projectTargets);
fout << "\tEndGlobalSection\n";
// Write the footer for the SLN file
--- 126,130 ----
<< ") = postSolution\n";
// Write out the configurations for all the targets in the project
! this->WriteTargetConfigurations(fout, root, orderedProjectTargets);
fout << "\tEndGlobalSection\n";
// Write the footer for the SLN file
Index: cmGlobalVisualStudio7Generator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalVisualStudio7Generator.cxx,v
retrieving revision 1.102
retrieving revision 1.103
diff -C 2 -d -r1.102 -r1.103
*** cmGlobalVisualStudio7Generator.cxx 1 Oct 2008 13:04:27 -0000 1.102
--- cmGlobalVisualStudio7Generator.cxx 21 Jan 2009 21:39:42 -0000 1.103
***************
*** 254,266 ****
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);
! }
}
}
--- 254,258 ----
if(!this->IsExcluded(root, *t))
{
! target->AddUtility(t->GetName());
}
}
***************
*** 270,281 ****
std::ostream& fout,
cmLocalGenerator* root,
! cmGlobalGenerator::TargetDependSet& projectTargets)
{
// loop over again and write out configurations for each target
// in the solution
! for(cmGlobalGenerator::TargetDependSet::iterator tt =
projectTargets.begin(); tt != projectTargets.end(); ++tt)
{
! cmTarget* target = const_cast<cmTarget*>(*tt);
if (strncmp(target->GetName(), "INCLUDE_EXTERNAL_MSPROJECT", 26) == 0)
{
--- 262,273 ----
std::ostream& fout,
cmLocalGenerator* root,
! OrderedTargetDependSet const& projectTargets)
{
// loop over again and write out configurations for each target
// in the solution
! for(OrderedTargetDependSet::const_iterator tt =
projectTargets.begin(); tt != projectTargets.end(); ++tt)
{
! cmTarget* target = *tt;
if (strncmp(target->GetName(), "INCLUDE_EXTERNAL_MSPROJECT", 26) == 0)
{
***************
*** 305,309 ****
std::ostream& fout,
cmLocalGenerator* root,
! cmGlobalGenerator::TargetDependSet& projectTargets,
cmGlobalGenerator::TargetDependSet& originalTargets
)
--- 297,301 ----
std::ostream& fout,
cmLocalGenerator* root,
! OrderedTargetDependSet const& projectTargets,
cmGlobalGenerator::TargetDependSet& originalTargets
)
***************
*** 311,318 ****
std::string rootdir = root->GetMakefile()->GetStartOutputDirectory();
rootdir += "/";
! for(cmGlobalGenerator::TargetDependSet::iterator tt =
projectTargets.begin(); tt != projectTargets.end(); ++tt)
{
! cmTarget* target = const_cast<cmTarget*>(*tt);
cmMakefile* mf = target->GetMakefile();
// look for the all_build rule and add depends to all
--- 303,310 ----
std::string rootdir = root->GetMakefile()->GetStartOutputDirectory();
rootdir += "/";
! for(OrderedTargetDependSet::const_iterator tt =
projectTargets.begin(); tt != projectTargets.end(); ++tt)
{
! cmTarget* target = *tt;
cmMakefile* mf = target->GetMakefile();
// look for the all_build rule and add depends to all
***************
*** 371,381 ****
void cmGlobalVisualStudio7Generator::WriteTargetDepends(
std::ostream& fout,
! cmGlobalGenerator::TargetDependSet& projectTargets
)
{
! for(cmGlobalGenerator::TargetDependSet::iterator tt =
projectTargets.begin(); tt != projectTargets.end(); ++tt)
{
! cmTarget* target = const_cast<cmTarget*>(*tt);
cmMakefile* mf = target->GetMakefile();
if (strncmp(target->GetName(), "INCLUDE_EXTERNAL_MSPROJECT", 26) == 0)
--- 363,373 ----
void cmGlobalVisualStudio7Generator::WriteTargetDepends(
std::ostream& fout,
! OrderedTargetDependSet const& projectTargets
)
{
! for(OrderedTargetDependSet::const_iterator tt =
projectTargets.begin(); tt != projectTargets.end(); ++tt)
{
! cmTarget* target = *tt;
cmMakefile* mf = target->GetMakefile();
if (strncmp(target->GetName(), "INCLUDE_EXTERNAL_MSPROJECT", 26) == 0)
***************
*** 435,439 ****
originalTargets,
root, generators);
! this->WriteTargetsToSolution(fout, root, projectTargets, originalTargets);
// Write out the configurations information for the solution
fout << "Global\n"
--- 427,433 ----
originalTargets,
root, generators);
! OrderedTargetDependSet orderedProjectTargets(projectTargets);
! this->WriteTargetsToSolution(fout, root, orderedProjectTargets,
! originalTargets);
// Write out the configurations information for the solution
fout << "Global\n"
***************
*** 450,459 ****
// Write out project(target) depends
fout << "\tGlobalSection(ProjectDependencies) = postSolution\n";
! this->WriteTargetDepends(fout, projectTargets);
fout << "\tEndGlobalSection\n";
// Write out the configurations for all the targets in the project
fout << "\tGlobalSection(ProjectConfiguration) = postSolution\n";
! this->WriteTargetConfigurations(fout, root, projectTargets);
fout << "\tEndGlobalSection\n";
--- 444,453 ----
// Write out project(target) depends
fout << "\tGlobalSection(ProjectDependencies) = postSolution\n";
! 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, orderedProjectTargets);
fout << "\tEndGlobalSection\n";
***************
*** 732,735 ****
--- 726,748 ----
//----------------------------------------------------------------------------
+ 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[] =
{
Index: cmGlobalVisualStudio7Generator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalVisualStudio7Generator.h,v
retrieving revision 1.45
retrieving revision 1.46
diff -C 2 -d -r1.45 -r1.46
*** cmGlobalVisualStudio7Generator.h 31 Jan 2008 21:38:45 -0000 1.45
--- cmGlobalVisualStudio7Generator.h 21 Jan 2009 21:39:43 -0000 1.46
***************
*** 98,101 ****
--- 98,106 ----
virtual const char* GetCMakeCFGInitDirectory() { return "$(OutDir)"; }
+ struct TargetCompare
+ {
+ bool operator()(cmTarget const* l, cmTarget const* r);
+ };
+
protected:
static cmVS7FlagTable const* GetExtraFlagTableVS7();
***************
*** 115,130 ****
virtual void AddPlatformDefinitions(cmMakefile* mf);
virtual void WriteTargetsToSolution(
std::ostream& fout,
cmLocalGenerator* root,
! cmGlobalGenerator::TargetDependSet& projectTargets,
cmGlobalGenerator::TargetDependSet& originalTargets);
virtual void WriteTargetDepends(
std::ostream& fout,
! cmGlobalGenerator::TargetDependSet& projectTargets);
virtual void WriteTargetConfigurations(
std::ostream& fout,
cmLocalGenerator* root,
! cmGlobalGenerator::TargetDependSet& projectTargets);
void AddAllBuildDepends(cmLocalGenerator* root,
--- 120,141 ----
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,
! OrderedTargetDependSet const& projectTargets,
cmGlobalGenerator::TargetDependSet& originalTargets);
virtual void WriteTargetDepends(
std::ostream& fout,
! OrderedTargetDependSet const& projectTargets);
virtual void WriteTargetConfigurations(
std::ostream& fout,
cmLocalGenerator* root,
! OrderedTargetDependSet const& projectTargets);
void AddAllBuildDepends(cmLocalGenerator* root,
More information about the Cmake-commits
mailing list