diff options
author | Pavel Solodovnikov <hellyeahdominate@gmail.com> | 2017-09-11 10:40:26 (GMT) |
---|---|---|
committer | Pavel Solodovnikov <hellyeahdominate@gmail.com> | 2017-09-12 13:22:47 (GMT) |
commit | 7d5095796ab616cf9b709036387bb95ab9984141 (patch) | |
tree | c010e922adad95ef86ab4a3ac2a3abd63e9f33ef /Source/cmExportBuildAndroidMKGenerator.cxx | |
parent | 00975e926199eea21763470e2ab876246e36669a (diff) | |
download | CMake-7d5095796ab616cf9b709036387bb95ab9984141.zip CMake-7d5095796ab616cf9b709036387bb95ab9984141.tar.gz CMake-7d5095796ab616cf9b709036387bb95ab9984141.tar.bz2 |
Meta: modernize old-fashioned loops to range-based `for`.
Changes done via `clang-tidy` with some manual fine-tuning
for the variable naming and `auto` type deduction
where appropriate.
Diffstat (limited to 'Source/cmExportBuildAndroidMKGenerator.cxx')
-rw-r--r-- | Source/cmExportBuildAndroidMKGenerator.cxx | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/Source/cmExportBuildAndroidMKGenerator.cxx b/Source/cmExportBuildAndroidMKGenerator.cxx index 8662e8a..b5b7214 100644 --- a/Source/cmExportBuildAndroidMKGenerator.cxx +++ b/Source/cmExportBuildAndroidMKGenerator.cxx @@ -3,7 +3,6 @@ #include "cmExportBuildAndroidMKGenerator.h" #include <algorithm> -#include <map> #include <sstream> #include <utility> @@ -98,43 +97,41 @@ void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties( } if (!properties.empty()) { os << "LOCAL_CPP_FEATURES := rtti exceptions\n"; - for (ImportPropertyMap::const_iterator pi = properties.begin(); - pi != properties.end(); ++pi) { - if (pi->first == "INTERFACE_COMPILE_OPTIONS") { + for (auto const& property : properties) { + if (property.first == "INTERFACE_COMPILE_OPTIONS") { os << "LOCAL_CPP_FEATURES += "; - os << (pi->second) << "\n"; - } else if (pi->first == "INTERFACE_LINK_LIBRARIES") { + os << (property.second) << "\n"; + } else if (property.first == "INTERFACE_LINK_LIBRARIES") { // need to look at list in pi->second and see if static or shared // FindTargetToLink // target->GetLocalGenerator()->FindGeneratorTargetToUse() // then add to LOCAL_CPPFLAGS std::vector<std::string> libraries; - cmSystemTools::ExpandListArgument(pi->second, libraries); + cmSystemTools::ExpandListArgument(property.second, libraries); std::string staticLibs; std::string sharedLibs; std::string ldlibs; - for (std::vector<std::string>::iterator i = libraries.begin(); - i != libraries.end(); ++i) { + for (std::string const& lib : libraries) { cmGeneratorTarget* gt = - target->GetLocalGenerator()->FindGeneratorTargetToUse(*i); + target->GetLocalGenerator()->FindGeneratorTargetToUse(lib); if (gt) { if (gt->GetType() == cmStateEnums::SHARED_LIBRARY || gt->GetType() == cmStateEnums::MODULE_LIBRARY) { - sharedLibs += " " + *i; + sharedLibs += " " + lib; } else { - staticLibs += " " + *i; + staticLibs += " " + lib; } } else { // evaluate any generator expressions with the current // build type of the makefile cmGeneratorExpression ge; - CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(*i); + CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(lib); std::string evaluated = cge->Evaluate(target->GetLocalGenerator(), config); bool relpath = false; if (type == cmExportBuildAndroidMKGenerator::INSTALL) { - relpath = i->substr(0, 3) == "../"; + relpath = lib.substr(0, 3) == "../"; } // check for full path or if it already has a -l, or // in the case of an install check for relative paths @@ -157,20 +154,19 @@ void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties( if (!ldlibs.empty()) { os << "LOCAL_EXPORT_LDLIBS :=" << ldlibs << "\n"; } - } else if (pi->first == "INTERFACE_INCLUDE_DIRECTORIES") { - std::string includes = pi->second; + } else if (property.first == "INTERFACE_INCLUDE_DIRECTORIES") { + std::string includes = property.second; std::vector<std::string> includeList; cmSystemTools::ExpandListArgument(includes, includeList); os << "LOCAL_EXPORT_C_INCLUDES := "; std::string end; - for (std::vector<std::string>::iterator i = includeList.begin(); - i != includeList.end(); ++i) { - os << end << *i; + for (std::string const& i : includeList) { + os << end << i; end = "\\\n"; } os << "\n"; } else { - os << "# " << pi->first << " " << (pi->second) << "\n"; + os << "# " << property.first << " " << (property.second) << "\n"; } } } |