diff options
author | Brad King <brad.king@kitware.com> | 2017-09-13 12:34:49 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2017-09-13 12:35:05 (GMT) |
commit | 67810849b95acfe036a9a605dbda6f0a3d6f7493 (patch) | |
tree | fa63356603dd00956f306eb92d4ecdbca9e450d4 /Source/cmExportLibraryDependenciesCommand.cxx | |
parent | a763cffd6b65bbe5572527e39969981bf31d5aca (diff) | |
parent | 7d5095796ab616cf9b709036387bb95ab9984141 (diff) | |
download | CMake-67810849b95acfe036a9a605dbda6f0a3d6f7493.zip CMake-67810849b95acfe036a9a605dbda6f0a3d6f7493.tar.gz CMake-67810849b95acfe036a9a605dbda6f0a3d6f7493.tar.bz2 |
Merge topic 'ranged-for'
7d509579 Meta: modernize old-fashioned loops to range-based `for`.
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1249
Diffstat (limited to 'Source/cmExportLibraryDependenciesCommand.cxx')
-rw-r--r-- | Source/cmExportLibraryDependenciesCommand.cxx | 42 |
1 files changed, 17 insertions, 25 deletions
diff --git a/Source/cmExportLibraryDependenciesCommand.cxx b/Source/cmExportLibraryDependenciesCommand.cxx index a1fdeae..cf12d33 100644 --- a/Source/cmExportLibraryDependenciesCommand.cxx +++ b/Source/cmExportLibraryDependenciesCommand.cxx @@ -4,7 +4,6 @@ #include "cmsys/FStream.hxx" #include <map> -#include <unordered_map> #include <utility> #include "cmGeneratedFileStream.h" @@ -75,12 +74,11 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const std::map<std::string, std::string> libDepsOld; std::map<std::string, std::string> libDepsNew; std::map<std::string, std::string> libTypes; - for (std::vector<cmMakefile*>::const_iterator i = locals.begin(); - i != locals.end(); ++i) { - const cmTargets& tgts = (*i)->GetTargets(); - for (cmTargets::const_iterator l = tgts.begin(); l != tgts.end(); ++l) { + for (cmMakefile* local : locals) { + const cmTargets& tgts = local->GetTargets(); + for (auto const& tgt : tgts) { // Get the current target. - cmTarget const& target = l->second; + cmTarget const& target = tgt.second; // Skip non-library targets. if (target.GetType() < cmStateEnums::STATIC_LIBRARY || @@ -98,12 +96,11 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const std::string valueNew; cmTarget::LinkLibraryVectorType const& libs = target.GetOriginalLinkLibraries(); - for (cmTarget::LinkLibraryVectorType::const_iterator li = libs.begin(); - li != libs.end(); ++li) { - std::string ltVar = li->first; + for (cmTarget::LibraryID const& li : libs) { + std::string ltVar = li.first; ltVar += "_LINK_TYPE"; std::string ltValue; - switch (li->second) { + switch (li.second) { case GENERAL_LibraryType: valueNew += "general;"; ltValue = "general"; @@ -117,7 +114,7 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const ltValue = "optimized"; break; } - std::string lib = li->first; + std::string lib = li.first; if (cmTarget* libtgt = global->FindTarget(lib)) { // Handle simple output name changes. This command is // deprecated so we do not support full target name @@ -150,26 +147,21 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const fout << "# Generated by CMake\n\n"; fout << "if(" << vertest << ")\n"; fout << " # Information for CMake 2.6 and above.\n"; - for (std::map<std::string, std::string>::const_iterator i = - libDepsNew.begin(); - i != libDepsNew.end(); ++i) { - if (!i->second.empty()) { - fout << " set(\"" << i->first << "\" \"" << i->second << "\")\n"; + for (auto const& i : libDepsNew) { + if (!i.second.empty()) { + fout << " set(\"" << i.first << "\" \"" << i.second << "\")\n"; } } fout << "else()\n"; fout << " # Information for CMake 2.4 and lower.\n"; - for (std::map<std::string, std::string>::const_iterator i = - libDepsOld.begin(); - i != libDepsOld.end(); ++i) { - if (!i->second.empty()) { - fout << " set(\"" << i->first << "\" \"" << i->second << "\")\n"; + for (auto const& i : libDepsOld) { + if (!i.second.empty()) { + fout << " set(\"" << i.first << "\" \"" << i.second << "\")\n"; } } - for (std::map<std::string, std::string>::const_iterator i = libTypes.begin(); - i != libTypes.end(); ++i) { - if (i->second != "general") { - fout << " set(\"" << i->first << "\" \"" << i->second << "\")\n"; + for (auto const& i : libTypes) { + if (i.second != "general") { + fout << " set(\"" << i.first << "\" \"" << i.second << "\")\n"; } } fout << "endif()\n"; |