diff options
Diffstat (limited to 'Source/cmLocalVisualStudio7Generator.cxx')
-rw-r--r-- | Source/cmLocalVisualStudio7Generator.cxx | 108 |
1 files changed, 45 insertions, 63 deletions
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 7019552..7c67192 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -293,9 +293,8 @@ void cmLocalVisualStudio7Generator::WriteConfigurations( const std::string& libName, cmGeneratorTarget* target) { fout << "\t<Configurations>\n"; - for (std::vector<std::string>::const_iterator i = configs.begin(); - i != configs.end(); ++i) { - this->WriteConfiguration(fout, i->c_str(), libName, target); + for (std::string const& config : configs) { + this->WriteConfiguration(fout, config.c_str(), libName, target); } fout << "\t</Configurations>\n"; } @@ -569,9 +568,8 @@ public: void Finish() { this->Stream << (this->First ? "" : "\"") << "/>\n"; } void Write(std::vector<cmCustomCommand> const& ccs) { - for (std::vector<cmCustomCommand>::const_iterator ci = ccs.begin(); - ci != ccs.end(); ++ci) { - this->Write(*ci); + for (cmCustomCommand const& command : ccs) { + this->Write(command); } } void Write(cmCustomCommand const& cc) @@ -897,10 +895,8 @@ void cmLocalVisualStudio7Generator::WriteConfiguration( target->GetManifests(manifest_srcs, configName); if (!manifest_srcs.empty()) { fout << "\n\t\t\t\tAdditionalManifestFiles=\""; - for (std::vector<cmSourceFile const*>::const_iterator mi = - manifest_srcs.begin(); - mi != manifest_srcs.end(); ++mi) { - std::string m = (*mi)->GetFullPath(); + for (cmSourceFile const* manifest : manifest_srcs) { + std::string m = manifest->GetFullPath(); fout << this->ConvertToXMLOutputPath(m.c_str()) << ";"; } fout << "\""; @@ -1303,14 +1299,14 @@ void cmLocalVisualStudio7GeneratorInternals::OutputLibraries( { cmLocalVisualStudio7Generator* lg = this->LocalGenerator; std::string currentBinDir = lg->GetCurrentBinaryDirectory(); - for (ItemVector::const_iterator l = libs.begin(); l != libs.end(); ++l) { - if (l->IsPath) { + for (auto const& lib : libs) { + if (lib.IsPath) { std::string rel = - lg->MaybeConvertToRelativePath(currentBinDir, l->Value.c_str()); + lg->MaybeConvertToRelativePath(currentBinDir, lib.Value.c_str()); fout << lg->ConvertToXMLOutputPath(rel.c_str()) << " "; - } else if (!l->Target || - l->Target->GetType() != cmStateEnums::INTERFACE_LIBRARY) { - fout << l->Value << " "; + } else if (!lib.Target || + lib.Target->GetType() != cmStateEnums::INTERFACE_LIBRARY) { + fout << lib.Value << " "; } } } @@ -1328,10 +1324,9 @@ void cmLocalVisualStudio7GeneratorInternals::OutputObjects( gt->GetExternalObjects(objs, configName); const char* sep = isep ? isep : ""; - for (std::vector<cmSourceFile const*>::const_iterator i = objs.begin(); - i != objs.end(); ++i) { - if (!(*i)->GetObjectLibrary().empty()) { - std::string const& objFile = (*i)->GetFullPath(); + for (cmSourceFile const* obj : objs) { + if (!obj->GetObjectLibrary().empty()) { + std::string const& objFile = obj->GetFullPath(); std::string rel = lg->MaybeConvertToRelativePath(currentBinDir, objFile); fout << sep << lg->ConvertToXMLOutputPath(rel.c_str()); sep = " "; @@ -1344,10 +1339,8 @@ void cmLocalVisualStudio7Generator::OutputLibraryDirectories( { const char* comma = ""; std::string currentBinDir = this->GetCurrentBinaryDirectory(); - for (std::vector<std::string>::const_iterator d = dirs.begin(); - d != dirs.end(); ++d) { + for (std::string dir : dirs) { // Remove any trailing slash and skip empty paths. - std::string dir = *d; if (dir.back() == '/') { dir = dir.substr(0, dir.size() - 1); } @@ -1483,9 +1476,8 @@ cmLocalVisualStudio7GeneratorFCInfo::cmLocalVisualStudio7GeneratorFCInfo( // Compute per-source, per-config information. size_t ci = 0; - for (std::vector<std::string>::const_iterator i = configs.begin(); - i != configs.end(); ++i, ++ci) { - std::string configUpper = cmSystemTools::UpperCase(*i); + for (std::string const& config : configs) { + std::string configUpper = cmSystemTools::UpperCase(config); cmLVS7GFileConfig fc; std::string lang = @@ -1498,7 +1490,7 @@ cmLocalVisualStudio7GeneratorFCInfo::cmLocalVisualStudio7GeneratorFCInfo( lang = sourceLang; } - cmGeneratorExpressionInterpreter genexInterpreter(lg, *i, gt, lang); + cmGeneratorExpressionInterpreter genexInterpreter(lg, config, gt, lang); bool needfc = false; if (!objectName.empty()) { @@ -1564,7 +1556,7 @@ cmLocalVisualStudio7GeneratorFCInfo::cmLocalVisualStudio7GeneratorFCInfo( } } - const std::string& linkLanguage = gt->GetLinkerLanguage(i->c_str()); + const std::string& linkLanguage = gt->GetLinkerLanguage(config.c_str()); // If HEADER_FILE_ONLY is set, we must suppress this generation in // the project file fc.ExcludedFromBuild = sf.GetPropertyAsBool("HEADER_FILE_ONLY") || @@ -1589,8 +1581,9 @@ cmLocalVisualStudio7GeneratorFCInfo::cmLocalVisualStudio7GeneratorFCInfo( } if (needfc) { - this->FileConfigMap[*i] = fc; + this->FileConfigMap[config] = fc; } + ++ci; } } @@ -1654,16 +1647,14 @@ bool cmLocalVisualStudio7Generator::WriteGroup( } // Loop through each source in the source group. - for (std::vector<const cmSourceFile*>::const_iterator sf = - sourceFiles.begin(); - sf != sourceFiles.end(); ++sf) { - std::string source = (*sf)->GetFullPath(); + for (const cmSourceFile* sf : sourceFiles) { + std::string source = sf->GetFullPath(); if (source != libName || target->GetType() == cmStateEnums::UTILITY || target->GetType() == cmStateEnums::GLOBAL_TARGET) { // Look up the source kind and configs. std::map<cmSourceFile const*, size_t>::const_iterator map_it = - sources.Index.find(*sf); + sources.Index.find(sf); // The map entry must exist because we populated it earlier. assert(map_it != sources.Index.end()); cmGeneratorTarget::AllConfigSource const& acs = @@ -1676,7 +1667,7 @@ bool cmLocalVisualStudio7Generator::WriteGroup( // Tell MS-Dev what the source is. If the compiler knows how to // build it, then it will. fout << "\t\t\t\tRelativePath=\"" << d << "\">\n"; - if (cmCustomCommand const* command = (*sf)->GetCustomCommand()) { + if (cmCustomCommand const* command = sf->GetCustomCommand()) { this->WriteCustomRule(fout, configs, source.c_str(), *command, fcinfo); } else if (!fcinfo.FileConfigMap.empty()) { const char* aCompilerTool = "VCCLCompilerTool"; @@ -1684,8 +1675,8 @@ bool cmLocalVisualStudio7Generator::WriteGroup( if (this->FortranProject) { aCompilerTool = "VFFortranCompilerTool"; } - std::string const& lang = (*sf)->GetLanguage(); - std::string ext = (*sf)->GetExtension(); + std::string const& lang = sf->GetLanguage(); + std::string ext = sf->GetExtension(); ext = cmSystemTools::LowerCase(ext); if (ext == "idl") { aCompilerTool = "VCMIDLTool"; @@ -1713,12 +1704,10 @@ bool cmLocalVisualStudio7Generator::WriteGroup( if (acs.Kind == cmGeneratorTarget::SourceKindExternalObject) { aCompilerTool = "VCCustomBuildTool"; } - for (std::map<std::string, cmLVS7GFileConfig>::const_iterator fci = - fcinfo.FileConfigMap.begin(); - fci != fcinfo.FileConfigMap.end(); ++fci) { - cmLVS7GFileConfig const& fc = fci->second; + for (auto const& fci : fcinfo.FileConfigMap) { + cmLVS7GFileConfig const& fc = fci.second; fout << "\t\t\t\t<FileConfiguration\n" - << "\t\t\t\t\tName=\"" << fci->first << "|" + << "\t\t\t\t\tName=\"" << fci.first << "|" << gg->GetPlatformName() << "\""; if (fc.ExcludedFromBuild) { fout << " ExcludedFromBuild=\"true\""; @@ -1741,7 +1730,7 @@ bool cmLocalVisualStudio7Generator::WriteGroup( fileOptions.AddDefines(fc.CompileDefsConfig); // validate source level include directories std::vector<std::string> includes; - this->AppendIncludeDirectories(includes, fc.IncludeDirs, **sf); + this->AppendIncludeDirectories(includes, fc.IncludeDirs, *sf); fileOptions.AddIncludes(includes); fileOptions.OutputFlagMap(fout, 5); fileOptions.OutputAdditionalIncludeDirectories( @@ -1794,12 +1783,11 @@ void cmLocalVisualStudio7Generator::WriteCustomRule( if (this->FortranProject) { customTool = "VFCustomBuildTool"; } - for (std::vector<std::string>::const_iterator i = configs.begin(); - i != configs.end(); ++i) { - cmCustomCommandGenerator ccg(command, *i, this); - cmLVS7GFileConfig const& fc = fcinfo.FileConfigMap[*i]; + for (std::string const& config : configs) { + cmCustomCommandGenerator ccg(command, config, this); + cmLVS7GFileConfig const& fc = fcinfo.FileConfigMap[config]; fout << "\t\t\t\t<FileConfiguration\n"; - fout << "\t\t\t\t\tName=\"" << *i << "|" << gg->GetPlatformName() + fout << "\t\t\t\t\tName=\"" << config << "|" << gg->GetPlatformName() << "\">\n"; if (!fc.CompileFlags.empty()) { fout << "\t\t\t\t\t<Tool\n" @@ -1811,7 +1799,7 @@ void cmLocalVisualStudio7Generator::WriteCustomRule( std::string comment = this->ConstructComment(ccg); std::string script = this->ConstructScript(ccg); if (this->FortranProject) { - cmSystemTools::ReplaceString(script, "$(Configuration)", i->c_str()); + cmSystemTools::ReplaceString(script, "$(Configuration)", config.c_str()); } /* clang-format off */ fout << "\t\t\t\t\t<Tool\n" @@ -1832,12 +1820,10 @@ void cmLocalVisualStudio7Generator::WriteCustomRule( fout << this->ConvertToXMLOutputPath(source); } else { // Write out the dependencies for the rule. - for (std::vector<std::string>::const_iterator d = - ccg.GetDepends().begin(); - d != ccg.GetDepends().end(); ++d) { + for (std::string const& d : ccg.GetDepends()) { // Get the real name of the dependency in case it is a CMake target. std::string dep; - if (this->GetRealDependency(d->c_str(), i->c_str(), dep)) { + if (this->GetRealDependency(d.c_str(), config.c_str(), dep)) { fout << this->ConvertToXMLOutputPath(dep.c_str()) << ";"; } } @@ -1849,10 +1835,8 @@ void cmLocalVisualStudio7Generator::WriteCustomRule( } else { // Write a rule for the output generated by this command. const char* sep = ""; - for (std::vector<std::string>::const_iterator o = - ccg.GetOutputs().begin(); - o != ccg.GetOutputs().end(); ++o) { - fout << sep << this->ConvertToXMLOutputPathSingle(o->c_str()); + for (std::string const& output : ccg.GetOutputs()) { + fout << sep << this->ConvertToXMLOutputPathSingle(output.c_str()); sep = ";"; } } @@ -2063,16 +2047,14 @@ void cmLocalVisualStudio7Generator::WriteVCProjFooter( { fout << "\t<Globals>\n"; - std::vector<std::string> const& props = target->GetPropertyKeys(); - for (std::vector<std::string>::const_iterator i = props.begin(); - i != props.end(); ++i) { - if (i->find("VS_GLOBAL_") == 0) { - std::string name = i->substr(10); + for (std::string const& key : target->GetPropertyKeys()) { + if (key.find("VS_GLOBAL_") == 0) { + std::string name = key.substr(10); if (!name.empty()) { /* clang-format off */ fout << "\t\t<Global\n" << "\t\t\tName=\"" << name << "\"\n" - << "\t\t\tValue=\"" << target->GetProperty(*i) << "\"\n" + << "\t\t\tValue=\"" << target->GetProperty(key) << "\"\n" << "\t\t/>\n"; /* clang-format on */ } |