[Cmake-commits] CMake branch, next, updated. v3.1.0-1576-g7f21811

Stephen Kelly steveire at gmail.com
Thu Jan 8 16:32:38 EST 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  7f218113baea90ff726b2f72be85242d038a60ba (commit)
       via  55a73e6b1f70b3c8a783b130dff4c4689cea5ba2 (commit)
       via  8dc8d756bc278cd02f329b31218c2459908dc0bb (commit)
       via  b5813ceeb5b5f78351dd9f9c6af904db2f4451c9 (commit)
      from  94c538fe4db0eec3c5f059f57882d47f8cc4a272 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7f218113baea90ff726b2f72be85242d038a60ba
commit 7f218113baea90ff726b2f72be85242d038a60ba
Merge: 94c538f 55a73e6
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Jan 8 16:32:36 2015 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Jan 8 16:32:36 2015 -0500

    Merge topic 'join-algorithm' into next
    
    55a73e6b Use the cmJoin algorithm where possible.
    8dc8d756 cmStandardIncludes: Add a join algorithm for string containers.
    b5813cee cmInstallCommand: Remove unused variable.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=55a73e6b1f70b3c8a783b130dff4c4689cea5ba2
commit 55a73e6b1f70b3c8a783b130dff4c4689cea5ba2
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Jan 7 08:58:51 2015 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Thu Jan 8 22:28:18 2015 +0100

    Use the cmJoin algorithm where possible.

diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index f4fa5c6..09bd58c 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -448,18 +448,7 @@ std::string cmComputeLinkInformation::GetRPathLinkString()
     }
 
   // Construct the linker runtime search path.
-  std::string rpath_link;
-  const char* sep = "";
-  std::vector<std::string> const& dirs =
-    this->OrderDependentRPath->GetOrderedDirectories();
-  for(std::vector<std::string>::const_iterator di = dirs.begin();
-      di != dirs.end(); ++di)
-    {
-    rpath_link += sep;
-    sep = ":";
-    rpath_link += *di;
-    }
-  return rpath_link;
+  return cmJoin(this->OrderDependentRPath->GetOrderedDirectories(), ":");
 }
 
 //----------------------------------------------------------------------------
@@ -1999,18 +1988,7 @@ std::string cmComputeLinkInformation::GetRPathString(bool for_install)
   this->GetRPath(runtimeDirs, for_install);
 
   // Concatenate the paths.
-  std::string rpath;
-  const char* sep = "";
-  for(std::vector<std::string>::const_iterator ri = runtimeDirs.begin();
-      ri != runtimeDirs.end(); ++ri)
-    {
-    // Separate from previous path.
-    rpath += sep;
-    sep = this->GetRuntimeSep().c_str();
-
-    // Add this path.
-    rpath += *ri;
-    }
+  std::string rpath = cmJoin(runtimeDirs, this->GetRuntimeSep());
 
   // If the rpath will be replaced at install time, prepare space.
   if(!for_install && this->RuntimeUseChrpath)
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index 7ddf4d0..11c0c65 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -803,18 +803,9 @@ static const struct JoinNode : public cmGeneratorExpressionNode
                        const GeneratorExpressionContent *,
                        cmGeneratorExpressionDAGChecker *) const
   {
-    std::string result;
-
     std::vector<std::string> list;
     cmSystemTools::ExpandListArgument(parameters.front(), list);
-    std::string sep;
-    for(std::vector<std::string>::const_iterator li = list.begin();
-      li != list.end(); ++li)
-      {
-      result += sep + *li;
-      sep = parameters[1];
-      }
-    return result;
+    return cmJoin(list, parameters[1]);
   }
 } joinNode;
 
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index 12bb867..7997720 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -777,18 +777,8 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
       this->Makefile->GetLocalGenerator()->GetGlobalGenerator()
         ->GetExportSets()[exports.GetString()]->AddTargetExport(te);
 
-      std::vector<std::string> dirs = includesArgs.GetIncludeDirs();
-      if(!dirs.empty())
-        {
-        const char *sep = "";
-        for (std::vector<std::string>::const_iterator it = dirs.begin();
-            it != dirs.end(); ++it)
-          {
-          te->InterfaceIncludeDirectories += sep;
-          te->InterfaceIncludeDirectories += *it;
-          sep = ";";
-          }
-        }
+      te->InterfaceIncludeDirectories =
+          cmJoin(includesArgs.GetIncludeDirs(), ";");
       }
     }
 
diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx
index f1ea088..b58f240 100644
--- a/Source/cmListCommand.cxx
+++ b/Source/cmListCommand.cxx
@@ -353,15 +353,7 @@ bool cmListCommand::HandleInsertCommand(std::vector<std::string> const& args)
     cnt ++;
     }
 
-  std::string value;
-  const char* sep = "";
-  for ( cc = 0; cc < varArgsExpanded.size(); cc ++ )
-    {
-    value += sep;
-    value += varArgsExpanded[cc];
-    sep = ";";
-    }
-
+  std::string value = cmJoin(varArgsExpanded, ";");
   this->Makefile->AddDefinition(listName, value.c_str());
   return true;
 }
@@ -402,15 +394,8 @@ bool cmListCommand
       }
     }
 
-  std::string value;
-  const char* sep = "";
-  for ( cc = 0; cc < varArgsExpanded.size(); cc ++ )
-    {
-    value += sep;
-    value += varArgsExpanded[cc];
-    sep = ";";
-    }
 
+  std::string value = cmJoin(varArgsExpanded, ";");
   this->Makefile->AddDefinition(listName, value.c_str());
   return true;
 }
@@ -518,16 +503,7 @@ bool cmListCommand
 
   std::sort(varArgsExpanded.begin(), varArgsExpanded.end());
 
-  std::string value;
-  std::vector<std::string>::iterator it;
-  const char* sep = "";
-  for ( it = varArgsExpanded.begin(); it != varArgsExpanded.end(); ++ it )
-    {
-    value += sep;
-    value += it->c_str();
-    sep = ";";
-    }
-
+  std::string value = cmJoin(varArgsExpanded, ";");
   this->Makefile->AddDefinition(listName, value.c_str());
   return true;
 }
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 20dae5a..590aa5f 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1791,22 +1791,12 @@ void cmMakefile::AddIncludeDirectories(const std::vector<std::string> &incs,
     return;
     }
 
-  std::string incString;
-  std::string sep;
-
-  for(std::vector<std::string>::const_iterator li = incs.begin();
-      li != incs.end(); ++li)
-    {
-    incString += sep + *li;
-    sep = ";";
-    }
-
   std::vector<cmValueWithOrigin>::iterator position =
                               before ? this->IncludeDirectoriesEntries.begin()
                                     : this->IncludeDirectoriesEntries.end();
 
   cmListFileBacktrace lfbt = this->GetBacktrace();
-  cmValueWithOrigin entry(incString, lfbt);
+  cmValueWithOrigin entry(cmJoin(incs, ";"), lfbt);
   this->IncludeDirectoriesEntries.insert(position, entry);
 
   // Property on each target:
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index a01a384..ec9f7c7 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -224,16 +224,7 @@ std::string cmQtAutoGenerators::ListQt5RccInputs(cmSourceFile* sf,
       }
     }
   depends.insert(depends.end(), qrcEntries.begin(), qrcEntries.end());
-  std::string entriesList;
-  const char* sep = "";
-  for(std::vector<std::string>::const_iterator it = qrcEntries.begin();
-      it != qrcEntries.end(); ++it)
-    {
-    entriesList += sep;
-    entriesList += *it;
-    sep = "@list_sep@";
-    }
-  return entriesList;
+  return cmJoin(qrcEntries, "@list_sep@");
 }
 
 std::string cmQtAutoGenerators::ListQt4RccInputs(cmSourceFile* sf,
@@ -512,29 +503,13 @@ static void GetCompileDefinitionsAndDirectories(cmTarget const* target,
   // Get the include dirs for this target, without stripping the implicit
   // include dirs off, see http://public.kitware.com/Bug/view.php?id=13667
   localGen->GetIncludeDirectories(includeDirs, gtgt, "CXX", config, false);
-  const char* sep = "";
-  incs = "";
-  for(std::vector<std::string>::const_iterator incDirIt = includeDirs.begin();
-      incDirIt != includeDirs.end();
-      ++incDirIt)
-    {
-    incs += sep;
-    sep = ";";
-    incs += *incDirIt;
-    }
+
+  incs = cmJoin(includeDirs, ";");
 
   std::set<std::string> defines;
   localGen->AddCompileDefinitions(defines, target, config);
 
-  sep = "";
-  for(std::set<std::string>::const_iterator defIt = defines.begin();
-      defIt != defines.end();
-      ++defIt)
-    {
-    defs += sep;
-    sep = ";";
-    defs += *defIt;
-    }
+  defs += cmJoin(defines, ";");
 }
 
 void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget const* target)
@@ -879,16 +854,7 @@ static void GetUicOpts(cmTarget const* target, const std::string& config,
 {
   std::vector<std::string> opts;
   target->GetAutoUicOptions(opts, config);
-
-  const char* sep = "";
-  for(std::vector<std::string>::const_iterator optIt = opts.begin();
-      optIt != opts.end();
-      ++optIt)
-    {
-    optString += sep;
-    sep = ";";
-    optString += *optIt;
-    }
+  optString = cmJoin(opts, ";");
 }
 
 void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target,
diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx
index cca995b..f4607c6 100644
--- a/Source/cmRST.cxx
+++ b/Source/cmRST.cxx
@@ -417,14 +417,7 @@ void cmRST::ProcessDirectiveReplace()
 {
   // Record markup lines as replacement text.
   std::string& replacement = this->Replace[this->ReplaceName];
-  const char* sep = "";
-  for(std::vector<std::string>::iterator i = this->MarkupLines.begin();
-      i != this->MarkupLines.end(); ++i)
-    {
-    replacement += sep;
-    replacement += *i;
-    sep = " ";
-    }
+  replacement += cmJoin(this->MarkupLines, " ");
   this->ReplaceName = "";
 }
 
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 1c8c387..28dd619 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -828,18 +828,12 @@ bool cmSystemTools::RunSingleCommand(
 std::string
 cmSystemTools::PrintSingleCommand(std::vector<std::string> const& command)
 {
-  std::string commandStr;
-  const char* sep = "";
-  for(std::vector<std::string>::const_iterator i = command.begin();
-      i != command.end(); ++i)
-    {
-    commandStr += sep;
-    commandStr += "\"";
-    commandStr += *i;
-    commandStr += "\"";
-    sep = " ";
-    }
-  return commandStr;
+  if (command.empty())
+    {
+    return std::string();
+    }
+
+  return "\"" + cmJoin(command, "\" \"") + "\"";
 }
 
 bool cmSystemTools::DoesFileExistWithExtensions(
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 94a6de3..52b8727 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -923,16 +923,7 @@ void cmTarget::GetSourceFiles(std::vector<cmSourceFile*> &files,
 //----------------------------------------------------------------------------
 void cmTarget::AddTracedSources(std::vector<std::string> const& srcs)
 {
-  std::string srcFiles;
-  const char* sep = "";
-  for(std::vector<std::string>::const_iterator i = srcs.begin();
-      i != srcs.end(); ++i)
-    {
-    std::string filename = *i;
-    srcFiles += sep;
-    srcFiles += filename;
-    sep = ";";
-    }
+  std::string srcFiles = cmJoin(srcs, ";");
   if (!srcFiles.empty())
     {
     this->Internal->SourceFilesMap.clear();
@@ -6088,24 +6079,8 @@ cmTargetInternals::ComputeLinkInterfaceLibraries(
         }
       if (ifaceLibs != iface.Libraries)
         {
-        std::string oldLibraries;
-        std::string newLibraries;
-        const char *sep = "";
-        for(std::vector<cmLinkImplItem>::const_iterator it
-              = impl->Libraries.begin(); it != impl->Libraries.end(); ++it)
-          {
-          oldLibraries += sep;
-          oldLibraries += *it;
-          sep = ";";
-          }
-        sep = "";
-        for(std::vector<cmLinkItem>::const_iterator it
-              = ifaceLibs.begin(); it != ifaceLibs.end(); ++it)
-          {
-          newLibraries += sep;
-          newLibraries += *it;
-          sep = ";";
-          }
+        std::string oldLibraries = cmJoin(impl->Libraries, ";");
+        std::string newLibraries = cmJoin(ifaceLibs, ";");
         if(oldLibraries.empty())
           { oldLibraries = "(empty)"; }
         if(newLibraries.empty())
diff --git a/Source/cmTargetCompileFeaturesCommand.cxx b/Source/cmTargetCompileFeaturesCommand.cxx
index 10daad4..82ce1e3 100644
--- a/Source/cmTargetCompileFeaturesCommand.cxx
+++ b/Source/cmTargetCompileFeaturesCommand.cxx
@@ -40,15 +40,7 @@ void cmTargetCompileFeaturesCommand
 std::string cmTargetCompileFeaturesCommand
 ::Join(const std::vector<std::string> &content)
 {
-  std::string defs;
-  std::string sep;
-  for(std::vector<std::string>::const_iterator it = content.begin();
-    it != content.end(); ++it)
-    {
-    defs += sep + *it;
-    sep = ";";
-    }
-  return defs;
+  return cmJoin(content, ";");
 }
 
 //----------------------------------------------------------------------------
diff --git a/Source/cmTargetCompileOptionsCommand.cxx b/Source/cmTargetCompileOptionsCommand.cxx
index 3fb76a6..e1d9b4f 100644
--- a/Source/cmTargetCompileOptionsCommand.cxx
+++ b/Source/cmTargetCompileOptionsCommand.cxx
@@ -39,15 +39,7 @@ void cmTargetCompileOptionsCommand
 std::string cmTargetCompileOptionsCommand
 ::Join(const std::vector<std::string> &content)
 {
-  std::string defs;
-  std::string sep;
-  for(std::vector<std::string>::const_iterator it = content.begin();
-    it != content.end(); ++it)
-    {
-    defs += sep + *it;
-    sep = ";";
-    }
-  return defs;
+  return cmJoin(content, ";");
 }
 
 //----------------------------------------------------------------------------
diff --git a/Source/cmTargetIncludeDirectoriesCommand.cxx b/Source/cmTargetIncludeDirectoriesCommand.cxx
index e9f0e04..cf8b656 100644
--- a/Source/cmTargetIncludeDirectoriesCommand.cxx
+++ b/Source/cmTargetIncludeDirectoriesCommand.cxx
@@ -91,15 +91,7 @@ void cmTargetIncludeDirectoriesCommand
 
   if (system)
     {
-    std::string joined;
-    std::string sep;
-    for(std::vector<std::string>::const_iterator it = content.begin();
-      it != content.end(); ++it)
-      {
-      joined += sep;
-      sep = ";";
-      joined += *it;
-      }
+    std::string joined = cmJoin(content, ";");
     tgt->AppendProperty("INTERFACE_SYSTEM_INCLUDE_DIRECTORIES",
                         joined.c_str());
     }
diff --git a/Source/cmTargetSourcesCommand.cxx b/Source/cmTargetSourcesCommand.cxx
index ce3b11e..31a47b7 100644
--- a/Source/cmTargetSourcesCommand.cxx
+++ b/Source/cmTargetSourcesCommand.cxx
@@ -44,15 +44,7 @@ void cmTargetSourcesCommand
 std::string cmTargetSourcesCommand
 ::Join(const std::vector<std::string> &content)
 {
-  std::string srcs;
-  std::string sep;
-  for(std::vector<std::string>::const_iterator it = content.begin();
-    it != content.end(); ++it)
-    {
-    srcs += sep + *it;
-    sep = ";";
-    }
-  return srcs;
+  return cmJoin(content, ";");
 }
 
 //----------------------------------------------------------------------------
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index bbd3fe4..d155d64 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -2320,14 +2320,7 @@ const char *cmake::GetProperty(const std::string& prop,
       {
       std::vector<std::string> enLangs;
       this->GlobalGenerator->GetEnabledLanguages(enLangs);
-      const char* sep = "";
-      for(std::vector<std::string>::iterator i = enLangs.begin();
-          i != enLangs.end(); ++i)
-        {
-        lang += sep;
-        sep = ";";
-        lang += *i;
-        }
+      lang = cmJoin(enLangs, ";");
       }
     this->SetProperty("ENABLED_LANGUAGES", lang.c_str());
     }

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8dc8d756bc278cd02f329b31218c2459908dc0bb
commit 8dc8d756bc278cd02f329b31218c2459908dc0bb
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Jan 7 08:21:29 2015 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Thu Jan 8 22:28:18 2015 +0100

    cmStandardIncludes: Add a join algorithm for string containers.
    
    This requires the input range to supply BidirectionalIterators, which
    is not a problem for where it is currently useful to us.  The alternative
    would be to not invoke --last;, and instead create an output iterator
    similar to std::ostream_iterator, but which puts the delimiter before
    the item to output.

diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h
index e4f5760..d7c6a65 100644
--- a/Source/cmStandardIncludes.h
+++ b/Source/cmStandardIncludes.h
@@ -358,6 +358,33 @@ static thisClass* SafeDownCast(cmObject *c) \
 } \
 class cmTypeMacro_UseTrailingSemicolon
 
+template<typename Range>
+std::string cmJoin(Range const& r, const char* delimiter)
+{
+  if (r.empty())
+    {
+    return std::string();
+    }
+  std::ostringstream os;
+  typedef typename Range::value_type ValueType;
+  typedef typename Range::const_iterator InputIt;
+  InputIt first = r.begin();
+  InputIt last = r.end();
+  --last;
+  std::copy(first, last,
+      std::ostream_iterator<ValueType>(os, delimiter));
+
+  os << *last;
+
+  return os.str();
+}
+
+template<typename Range>
+std::string cmJoin(Range const& r, std::string delimiter)
+{
+  return cmJoin(r, delimiter.c_str());
+};
+
 inline bool cmHasLiteralPrefixImpl(const std::string &str1,
                                  const char *str2,
                                  size_t N)

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b5813ceeb5b5f78351dd9f9c6af904db2f4451c9
commit b5813ceeb5b5f78351dd9f9c6af904db2f4451c9
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Jan 6 01:15:47 2015 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Thu Jan 8 22:25:18 2015 +0100

    cmInstallCommand: Remove unused variable.

diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index c3c9c55..12bb867 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -780,7 +780,6 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
       std::vector<std::string> dirs = includesArgs.GetIncludeDirs();
       if(!dirs.empty())
         {
-        std::string dirString;
         const char *sep = "";
         for (std::vector<std::string>::const_iterator it = dirs.begin();
             it != dirs.end(); ++it)

-----------------------------------------------------------------------

Summary of changes:
 Source/cmComputeLinkInformation.cxx          |   26 ++-------------
 Source/cmGeneratorExpressionEvaluator.cxx    |   11 +------
 Source/cmInstallCommand.cxx                  |   15 ++-------
 Source/cmListCommand.cxx                     |   30 ++----------------
 Source/cmMakefile.cxx                        |   12 +------
 Source/cmQtAutoGenerators.cxx                |   44 +++-----------------------
 Source/cmRST.cxx                             |    9 +-----
 Source/cmStandardIncludes.h                  |   27 ++++++++++++++++
 Source/cmSystemTools.cxx                     |   18 ++++-------
 Source/cmTarget.cxx                          |   31 ++----------------
 Source/cmTargetCompileFeaturesCommand.cxx    |   10 +-----
 Source/cmTargetCompileOptionsCommand.cxx     |   10 +-----
 Source/cmTargetIncludeDirectoriesCommand.cxx |   10 +-----
 Source/cmTargetSourcesCommand.cxx            |   10 +-----
 Source/cmake.cxx                             |    9 +-----
 15 files changed, 56 insertions(+), 216 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list