21a22,48 > //-------------------------------------------------------------------------- > bool > cmGlobalVisualStudio6Generator::TargetCompare > ::operator()(cmTarget const* l, cmTarget const* r) > { > // Make sure ALL_BUILD is first so it is the default active project. > if(strcmp(r->GetName(), "ALL_BUILD") == 0) > { > return false; > } > if(strcmp(l->GetName(), "ALL_BUILD") == 0) > { > return true; > } > return strcmp(l->GetName(), r->GetName()) < 0; > } > > //-------------------------------------------------------------------------- > cmGlobalVisualStudio6Generator::OrderedTargetDependSet > ::OrderedTargetDependSet(cmGlobalGenerator::TargetDependSet const& targets) > { > for(cmGlobalGenerator::TargetDependSet::const_iterator ti = > targets.begin(); ti != targets.end(); ++ti) > { > this->insert(*ti); > } > } 172,175c199,202 < // Write a DSW file to the stream < void cmGlobalVisualStudio6Generator < ::WriteDSWFile(std::ostream& fout,cmLocalGenerator* root, < std::vector& generators) --- > void cmGlobalVisualStudio6Generator::AddAllBuildDepends( > cmLocalGenerator* root, > cmTarget* target, > cmGlobalGenerator::TargetDependSet& originalTargets) 177,219d203 < // 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 dspnames = < static_cast(generators[i]) < ->GetCreatedProjectNames(); < cmTargets &tgts = generators[i]->GetMakefile()->GetTargets(); < std::vector::iterator si = dspnames.begin(); < for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l) < { < // special handling for the current makefile < if(mf == generators[0]->GetMakefile()) < { < dir = "."; // no subdirectory for project generated 222,224c206,207 < // 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) 226,227c209,210 < unsigned int j; < for(j = 0; j < generators.size(); ++j) --- > cmTarget* t = const_cast(*ot); > if(!this->IsExcluded(root, *t)) 229,231c212,213 < 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) 233,238c215 < 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()); --- > target->AddUtility(t->GetName()); 242c219 < l->second.AddLinkLibrary(al->first, cmTarget::GENERAL); --- > target->AddLinkLibrary(t->GetName(), cmTarget::GENERAL); 246a224,243 > void cmGlobalVisualStudio6Generator::WriteTargetsToDSW( > std::ostream& fout, > cmLocalGenerator* root, > OrderedTargetDependSet const& projectTargets, > cmGlobalGenerator::TargetDependSet& originalTargets > ) > { > 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 > // of the original targets (none that were "pulled" into this project) > if(mf == root->GetMakefile() && > strcmp(target->GetName(), "ALL_BUILD") == 0) > { > this->AddAllBuildDepends(root, target, originalTargets); 248,250c245,246 < } < // Write the project into the DSW file < if (strncmp(l->first.c_str(), "INCLUDE_EXTERNAL_MSPROJECT", 26) == 0) --- > // handle external vc project files > if (strncmp(target->GetName(), "INCLUDE_EXTERNAL_MSPROJECT", 26) == 0) 252c248 < cmCustomCommand cc = l->second.GetPostBuildCommands()[0]; --- > cmCustomCommand cc = target->GetPostBuildCommands()[0]; 262,318c258,262 < // 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 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())) 320c264 < if(donePackage) --- > if(target->GetMakefile() != root->GetMakefile()) 324,327d267 < else < { < donePackage = true; < } 328a269,270 > // if not skipping the project then write it into the > // solution 331c273,278 < this->WriteProject(fout, si->c_str(), dir.c_str(),l->second); --- > 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); 333d279 < ++si; 337a284,302 > // Write a DSW file to the stream > void cmGlobalVisualStudio6Generator > ::WriteDSWFile(std::ostream& fout,cmLocalGenerator* root, > std::vector& generators) > { > // Write out the header for a DSW file > this->WriteDSWHeader(fout); > // collect the set of targets for this project by > // tracing depends of all targets. > // also collect the set of targets that are explicitly > // in this project. > cmGlobalGenerator::TargetDependSet projectTargets; > cmGlobalGenerator::TargetDependSet originalTargets; > this->GetTargetSets(projectTargets, > originalTargets, > root, generators); > OrderedTargetDependSet orderedProjectTargets(projectTargets); > this->WriteTargetsToDSW(fout, root, orderedProjectTargets, > originalTargets);