Attached Files | cmGlobalVisualStudio6Generator.cxx.patch [^] (9,371 bytes) 2008-12-04 04:07 [Show Content] [Hide Content]Index: Source/cmGlobalVisualStudio6Generator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalVisualStudio6Generator.cxx,v
retrieving revision 1.75
diff -u -r1.75 cmGlobalVisualStudio6Generator.cxx
--- Source/cmGlobalVisualStudio6Generator.cxx 28 Jan 2008 13:38:35 -0000 1.75
+++ Source/cmGlobalVisualStudio6Generator.cxx 4 Dec 2008 08:31:51 -0000
@@ -181,7 +181,6 @@
std::string homedir = root->GetMakefile()->GetStartOutputDirectory();
homedir += "/";
- unsigned int i;
bool doneAllBuild = false;
bool doneRunTests = false;
bool doneInstall = false;
@@ -189,152 +188,150 @@
bool doneRebuildCache = false;
bool donePackage = false;
- for(i = 0; i < generators.size(); ++i)
+ cmGlobalGenerator::TargetDependSet projectTargets;
+ cmGlobalGenerator::TargetDependSet originalTargets;
+ this->GetTargetSets(projectTargets,
+ originalTargets,
+ root, generators);
+ for(cmGlobalGenerator::TargetDependSet::iterator tt =
+ projectTargets.begin(); tt != projectTargets.end(); ++tt)
{
- if(this->IsExcluded(root, generators[i]))
- {
- continue;
- }
- cmMakefile* mf = generators[i]->GetMakefile();
-
+ cmTarget* target = const_cast<cmTarget*>(*tt);
+ cmMakefile* mf = target->GetMakefile();
+ char const* name = target->GetName();
+
// Get the source directory from the makefile
std::string dir = mf->GetStartOutputDirectory();
// remove the home directory and / from the source directory
// this gives a relative path
cmSystemTools::ReplaceString(dir, homedir.c_str(), "");
- // Get the list of create dsp files names from the LocalGenerator, more
- // than one dsp could have been created per input CMakeLists.txt file
- // for each target
- std::vector<std::string> dspnames =
- static_cast<cmLocalVisualStudio6Generator *>(generators[i])
- ->GetCreatedProjectNames();
- cmTargets &tgts = generators[i]->GetMakefile()->GetTargets();
- std::vector<std::string>::iterator si = dspnames.begin();
- for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l)
+ // special handling for the current makefile
+ if(mf == root->GetMakefile())
{
- // special handling for the current makefile
- if(mf == generators[0]->GetMakefile())
+ dir = "."; // no subdirectory for project generated
+ // if this is the special ALL_BUILD utility, then
+ // make it depend on every other non UTILITY project.
+ // This is done by adding the names to the GetUtilities
+ // vector on the makefile
+ if(name == "ALL_BUILD" && !doneAllBuild)
{
- dir = "."; // no subdirectory for project generated
- // if this is the special ALL_BUILD utility, then
- // make it depend on every other non UTILITY project.
- // This is done by adding the names to the GetUtilities
- // vector on the makefile
- if(l->first == "ALL_BUILD" && !doneAllBuild)
+ for(cmGlobalGenerator::TargetDependSet::iterator ot =
+ originalTargets.begin(); ot != originalTargets.end(); ++ot)
{
- unsigned int j;
- for(j = 0; j < generators.size(); ++j)
+ cmTarget* t = const_cast<cmTarget*>(*ot);
+ if(!this->IsExcluded(root, *t))
{
- cmTargets &atgts = generators[j]->GetMakefile()->GetTargets();
- for(cmTargets::iterator al = atgts.begin();
- al != atgts.end(); ++al)
+ if (t->GetType() == cmTarget::UTILITY ||
+ t->GetType() == cmTarget::GLOBAL_TARGET)
+ {
+ target->AddUtility(t->GetName());
+ }
+ else
{
- if (!al->second.GetPropertyAsBool("EXCLUDE_FROM_ALL"))
- {
- if (al->second.GetType() == cmTarget::UTILITY ||
- al->second.GetType() == cmTarget::GLOBAL_TARGET)
- {
- l->second.AddUtility(al->first.c_str());
- }
- else
- {
- l->second.AddLinkLibrary(al->first, cmTarget::GENERAL);
- }
- }
+ target->AddLinkLibrary(t->GetName(),cmTarget::GENERAL);
}
}
}
}
- // Write the project into the DSW file
- if (strncmp(l->first.c_str(), "INCLUDE_EXTERNAL_MSPROJECT", 26) == 0)
+ }
+ // Write the project into the DSW file
+ if (strncmp(name, "INCLUDE_EXTERNAL_MSPROJECT", 26) == 0)
+ {
+ cmCustomCommand cc = target->GetPostBuildCommands()[0];
+ const cmCustomCommandLines& cmds = cc.GetCommandLines();
+ std::string project = cmds[0][0];
+ std::string location = cmds[0][1];
+ this->WriteExternalProject(fout, project.c_str(),
+ location.c_str(), cc.GetDepends());
+ }
+ else
+ {
+ bool skip = false;
+ // if it is a global target or the check build system target
+ // or the all_build target
+ // then only use the one that is for the root
+ if(target->GetType() == cmTarget::GLOBAL_TARGET
+ || !strcmp(target->GetName(), this->GetAllTargetName()))
{
- cmCustomCommand cc = l->second.GetPostBuildCommands()[0];
- const cmCustomCommandLines& cmds = cc.GetCommandLines();
- std::string project = cmds[0][0];
- std::string location = cmds[0][1];
- this->WriteExternalProject(fout, project.c_str(),
- location.c_str(), cc.GetDepends());
+ if(target->GetMakefile() != root->GetMakefile())
+ {
+ skip = true;
+ }
}
- else
+ // skip ALL_BUILD and RUN_TESTS if they have already been added
+ if(name == "ALL_BUILD" )
{
- bool skip = false;
- // skip ALL_BUILD and RUN_TESTS if they have already been added
- if(l->first == "ALL_BUILD" )
- {
- if(doneAllBuild)
- {
- skip = true;
- }
- else
- {
- doneAllBuild = true;
- }
- }
- if(l->first == "INSTALL")
- {
- if(doneInstall)
- {
- skip = true;
- }
- else
- {
- doneInstall = true;
- }
- }
- if(l->first == "RUN_TESTS")
- {
- if(doneRunTests)
- {
- skip = true;
- }
- else
- {
- doneRunTests = true;
- }
- }
- if(l->first == "EDIT_CACHE")
- {
- if(doneEditCache)
- {
- skip = true;
- }
- else
- {
- doneEditCache = true;
- }
- }
- if(l->first == "REBUILD_CACHE")
- {
- if(doneRebuildCache)
- {
- skip = true;
- }
- else
- {
- doneRebuildCache = true;
- }
- }
- if(l->first == "PACKAGE")
- {
- if(donePackage)
- {
- skip = true;
- }
- else
- {
- donePackage = true;
- }
- }
- if(!skip)
- {
- this->WriteProject(fout, si->c_str(), dir.c_str(),l->second);
- }
- ++si;
+ if(doneAllBuild)
+ {
+ skip = true;
+ }
+ else
+ {
+ doneAllBuild = true;
+ }
}
- }
+ if(name == "INSTALL")
+ {
+ if(doneInstall)
+ {
+ skip = true;
+ }
+ else
+ {
+ doneInstall = true;
+ }
+ }
+ if(name == "RUN_TESTS")
+ {
+ if(doneRunTests)
+ {
+ skip = true;
+ }
+ else
+ {
+ doneRunTests = true;
+ }
+ }
+ if(name == "EDIT_CACHE")
+ {
+ if(doneEditCache)
+ {
+ skip = true;
+ }
+ else
+ {
+ doneEditCache = true;
+ }
+ }
+ if(name == "REBUILD_CACHE")
+ {
+ if(doneRebuildCache)
+ {
+ skip = true;
+ }
+ else
+ {
+ doneRebuildCache = true;
+ }
+ }
+ if(name == "PACKAGE")
+ {
+ if(donePackage)
+ {
+ skip = true;
+ }
+ else
+ {
+ donePackage = true;
+ }
+ }
+ if(!skip)
+ {
+ this->WriteProject(fout, name, dir.c_str(),*target);
+ }
+ }
}
-
// Write the footer for the DSW file
this->WriteDSWFooter(fout);
}
New-cmGlobalVisualStudio6Generator.cxx.patch [^] (8,271 bytes) 2008-12-05 03:41 [Show Content] [Hide Content]Index: Source/cmGlobalVisualStudio6Generator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalVisualStudio6Generator.cxx,v
retrieving revision 1.75
diff -u -r1.75 cmGlobalVisualStudio6Generator.cxx
--- Source/cmGlobalVisualStudio6Generator.cxx 28 Jan 2008 13:38:35 -0000 1.75
+++ Source/cmGlobalVisualStudio6Generator.cxx 5 Dec 2008 08:38:40 -0000
@@ -177,164 +177,76 @@
// Write out the header for a DSW file
this->WriteDSWHeader(fout);
- // Get the home directory with the trailing slash
- std::string homedir = root->GetMakefile()->GetStartOutputDirectory();
- homedir += "/";
-
- unsigned int i;
- bool doneAllBuild = false;
- bool doneRunTests = false;
- bool doneInstall = false;
- bool doneEditCache = false;
- bool doneRebuildCache = false;
- bool donePackage = false;
-
- for(i = 0; i < generators.size(); ++i)
- {
- if(this->IsExcluded(root, generators[i]))
- {
- continue;
- }
- cmMakefile* mf = generators[i]->GetMakefile();
-
- // Get the source directory from the makefile
- std::string dir = mf->GetStartOutputDirectory();
- // remove the home directory and / from the source directory
- // this gives a relative path
- cmSystemTools::ReplaceString(dir, homedir.c_str(), "");
-
- // Get the list of create dsp files names from the LocalGenerator, more
- // than one dsp could have been created per input CMakeLists.txt file
- // for each target
- std::vector<std::string> dspnames =
- static_cast<cmLocalVisualStudio6Generator *>(generators[i])
- ->GetCreatedProjectNames();
- cmTargets &tgts = generators[i]->GetMakefile()->GetTargets();
- std::vector<std::string>::iterator si = dspnames.begin();
- for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l)
+ cmGlobalGenerator::TargetDependSet projectTargets;
+ cmGlobalGenerator::TargetDependSet originalTargets;
+ this->GetTargetSets(projectTargets,
+ originalTargets,
+ root, generators);
+ 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
+ // of the original targets (none that were "pulled" into this project)
+ if(mf == root->GetMakefile() &&
+ strcmp(target->GetName(), "ALL_BUILD") == 0)
{
- // special handling for the current makefile
- if(mf == generators[0]->GetMakefile())
+ for(cmGlobalGenerator::TargetDependSet::iterator ot =
+ originalTargets.begin(); ot != originalTargets.end(); ++ot)
{
- dir = "."; // no subdirectory for project generated
- // if this is the special ALL_BUILD utility, then
- // make it depend on every other non UTILITY project.
- // This is done by adding the names to the GetUtilities
- // vector on the makefile
- if(l->first == "ALL_BUILD" && !doneAllBuild)
+ cmTarget* t = const_cast<cmTarget*>(*ot);
+ if(!this->IsExcluded(root, *t))
{
- unsigned int j;
- for(j = 0; j < generators.size(); ++j)
+ if (t->GetType() == cmTarget::UTILITY ||
+ t->GetType() == cmTarget::GLOBAL_TARGET)
{
- cmTargets &atgts = generators[j]->GetMakefile()->GetTargets();
- for(cmTargets::iterator al = atgts.begin();
- al != atgts.end(); ++al)
- {
- if (!al->second.GetPropertyAsBool("EXCLUDE_FROM_ALL"))
- {
- if (al->second.GetType() == cmTarget::UTILITY ||
- al->second.GetType() == cmTarget::GLOBAL_TARGET)
- {
- l->second.AddUtility(al->first.c_str());
- }
- else
- {
- l->second.AddLinkLibrary(al->first, cmTarget::GENERAL);
- }
- }
- }
+ target->AddUtility(t->GetName());
+ }
+ else
+ {
+ target->AddLinkLibrary(t->GetName(),cmTarget::GENERAL);
}
}
}
- // Write the project into the DSW file
- if (strncmp(l->first.c_str(), "INCLUDE_EXTERNAL_MSPROJECT", 26) == 0)
+ }
+ // Write the project into the DSW file
+ if (strncmp(target->GetName(), "INCLUDE_EXTERNAL_MSPROJECT", 26) == 0)
+ {
+ cmCustomCommand cc = target->GetPostBuildCommands()[0];
+ const cmCustomCommandLines& cmds = cc.GetCommandLines();
+ std::string project = cmds[0][0];
+ std::string location = cmds[0][1];
+ this->WriteExternalProject(fout, project.c_str(),
+ location.c_str(), cc.GetDepends());
+ }
+ else
+ {
+ bool skip = false;
+ // if it is a global target or the check build system target
+ // or the all_build target
+ // then only use the one that is for the root
+ if(target->GetType() == cmTarget::GLOBAL_TARGET
+ || !strcmp(target->GetName(), this->GetAllTargetName()))
{
- cmCustomCommand cc = l->second.GetPostBuildCommands()[0];
- const cmCustomCommandLines& cmds = cc.GetCommandLines();
- std::string project = cmds[0][0];
- std::string location = cmds[0][1];
- this->WriteExternalProject(fout, project.c_str(),
- location.c_str(), cc.GetDepends());
+ if(target->GetMakefile() != root->GetMakefile())
+ {
+ skip = true;
+ }
}
- else
- {
- bool skip = false;
- // skip ALL_BUILD and RUN_TESTS if they have already been added
- if(l->first == "ALL_BUILD" )
- {
- if(doneAllBuild)
- {
- skip = true;
- }
- else
- {
- doneAllBuild = true;
- }
- }
- if(l->first == "INSTALL")
- {
- if(doneInstall)
- {
- skip = true;
- }
- else
- {
- doneInstall = true;
- }
- }
- if(l->first == "RUN_TESTS")
- {
- if(doneRunTests)
- {
- skip = true;
- }
- else
- {
- doneRunTests = true;
- }
- }
- if(l->first == "EDIT_CACHE")
- {
- if(doneEditCache)
- {
- skip = true;
- }
- else
- {
- doneEditCache = true;
- }
- }
- if(l->first == "REBUILD_CACHE")
- {
- if(doneRebuildCache)
- {
- skip = true;
- }
- else
- {
- doneRebuildCache = true;
- }
- }
- if(l->first == "PACKAGE")
- {
- if(donePackage)
- {
- skip = true;
- }
- else
- {
- donePackage = true;
- }
- }
- if(!skip)
- {
- this->WriteProject(fout, si->c_str(), dir.c_str(),l->second);
- }
- ++si;
+ // if not skipping the project then write it into the
+ // solution
+ if(!skip)
+ {
+ cmMakefile* tmf = target->GetMakefile();
+ std::string dir = tmf->GetStartOutputDirectory();
+ dir = root->Convert(dir.c_str(),
+ cmLocalGenerator::START_OUTPUT);
+ this->WriteProject(fout, target->GetName(), dir.c_str(),
+ *target);
}
}
}
-
// Write the footer for the DSW file
this->WriteDSWFooter(fout);
}
|