[Cmake-commits] CMake branch, master, updated. v3.10.2-898-ge46ca12

Kitware Robot kwrobot at kitware.com
Thu Jan 25 08:05:09 EST 2018


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, master has been updated
       via  e46ca12acf7b166eb865d4818d18a769219368a5 (commit)
       via  25243014e5367108604e03682b04dd5ec1e93673 (commit)
      from  5189c1e322381c65aa849e3b52d9b1e3b3541979 (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 -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e46ca12acf7b166eb865d4818d18a769219368a5
commit e46ca12acf7b166eb865d4818d18a769219368a5
Merge: 5189c1e 2524301
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Jan 25 12:59:00 2018 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Thu Jan 25 07:59:08 2018 -0500

    Merge topic 'stdstring'
    
    25243014 cmMakefile: use std::string in more methods; cleanup c_str()s
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !1685


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=25243014e5367108604e03682b04dd5ec1e93673
commit 25243014e5367108604e03682b04dd5ec1e93673
Author:     Vitaly Stakhovsky <vvs31415 at gitlab.org>
AuthorDate: Mon Jan 22 20:47:53 2018 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Jan 23 11:10:04 2018 -0500

    cmMakefile: use std::string in more methods; cleanup c_str()s
    
    Follow up commit 969c1f94ae (cmSourceGroup: code improvements; use
    std::string and C++11 loops, 2017-01-10).

diff --git a/Source/cmAddExecutableCommand.cxx b/Source/cmAddExecutableCommand.cxx
index b9e200a..2e95032 100644
--- a/Source/cmAddExecutableCommand.cxx
+++ b/Source/cmAddExecutableCommand.cxx
@@ -164,7 +164,7 @@ bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args,
 
   std::vector<std::string> srclists(s, args.end());
   cmTarget* tgt =
-    this->Makefile->AddExecutable(exename.c_str(), srclists, excludeFromAll);
+    this->Makefile->AddExecutable(exename, srclists, excludeFromAll);
   if (use_win32) {
     tgt->SetProperty("WIN32_EXECUTABLE", "ON");
   }
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index a200385..1fc0828 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -498,7 +498,7 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets(cmXMLWriter& xml)
             // Add the file to the list of sources.
             std::string const& source = sf->GetFullPath();
             cmSourceGroup* sourceGroup =
-              makefile->FindSourceGroup(source.c_str(), sourceGroups);
+              makefile->FindSourceGroup(source, sourceGroups);
             sourceGroup->AssignSource(sf);
           }
 
diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx
index b3e3393..d459436 100644
--- a/Source/cmGhsMultiTargetGenerator.cxx
+++ b/Source/cmGhsMultiTargetGenerator.cxx
@@ -486,7 +486,7 @@ void cmGhsMultiTargetGenerator::WriteSources(
   for (std::vector<cmSourceFile*>::const_iterator si = objectSources.begin();
        si != objectSources.end(); ++si) {
     std::vector<cmSourceGroup> sourceGroups(this->Makefile->GetSourceGroups());
-    char const* sourceFullPath = (*si)->GetFullPath().c_str();
+    std::string const& sourceFullPath = (*si)->GetFullPath();
     cmSourceGroup* sourceGroup =
       this->Makefile->FindSourceGroup(sourceFullPath, sourceGroups);
     std::string sgPath = sourceGroup->GetFullName();
@@ -604,7 +604,7 @@ std::string cmGhsMultiTargetGenerator::ComputeLongestObjectDirectory(
   dir_max += "/";
   std::vector<cmSourceGroup> sourceGroups(
     localGhsMultiGenerator->GetMakefile()->GetSourceGroups());
-  char const* const sourceFullPath = sourceFile->GetFullPath().c_str();
+  std::string const& sourceFullPath = sourceFile->GetFullPath();
   cmSourceGroup* sourceGroup =
     localGhsMultiGenerator->GetMakefile()->FindSourceGroup(sourceFullPath,
                                                            sourceGroups);
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 59c20a9..b55fa49 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -1410,7 +1410,7 @@ void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout,
     // Add the file to the list of sources.
     std::string const source = sf->GetFullPath();
     cmSourceGroup* sourceGroup =
-      this->Makefile->FindSourceGroup(source.c_str(), sourceGroups);
+      this->Makefile->FindSourceGroup(source, sourceGroups);
     sourceGroup->AssignSource(sf);
   }
 
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index eeeb54f..c12cd9e 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -664,7 +664,7 @@ struct file_not_persistent
   bool operator()(const std::string& path) const
   {
     return !(path.find("CMakeTmp") == std::string::npos &&
-             cmSystemTools::FileExists(path.c_str()));
+             cmSystemTools::FileExists(path));
   }
 };
 }
@@ -755,8 +755,9 @@ void cmMakefile::AddCustomCommandToTarget(
     return;
   }
 
+  cmTarget& t = ti->second;
   if (objLibraryCommands == RejectObjectLibraryCommands &&
-      ti->second.GetType() == cmStateEnums::OBJECT_LIBRARY) {
+      t.GetType() == cmStateEnums::OBJECT_LIBRARY) {
     std::ostringstream e;
     e << "Target \"" << target
       << "\" is an OBJECT library "
@@ -764,7 +765,7 @@ void cmMakefile::AddCustomCommandToTarget(
     this->IssueMessage(cmake::FATAL_ERROR, e.str());
     return;
   }
-  if (ti->second.GetType() == cmStateEnums::INTERFACE_LIBRARY) {
+  if (t.GetType() == cmStateEnums::INTERFACE_LIBRARY) {
     std::ostringstream e;
     e << "Target \"" << target
       << "\" is an INTERFACE library "
@@ -791,13 +792,13 @@ void cmMakefile::AddCustomCommandToTarget(
   cc.SetDepfile(depfile);
   switch (type) {
     case cmTarget::PRE_BUILD:
-      ti->second.AddPreBuildCommand(cc);
+      t.AddPreBuildCommand(cc);
       break;
     case cmTarget::PRE_LINK:
-      ti->second.AddPreLinkCommand(cc);
+      t.AddPreLinkCommand(cc);
       break;
     case cmTarget::POST_BUILD:
-      ti->second.AddPostBuildCommand(cc);
+      t.AddPostBuildCommand(cc);
       break;
   }
 }
@@ -1180,14 +1181,14 @@ bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove)
   static cmsys::RegularExpression valid("^[-/]D[A-Za-z_][A-Za-z0-9_]*(=.*)?$");
 
   // Make sure the definition matches.
-  if (!valid.find(def.c_str())) {
+  if (!valid.find(def)) {
     return false;
   }
 
   // Definitions with non-trivial values require a policy check.
   static cmsys::RegularExpression trivial(
     "^[-/]D[A-Za-z_][A-Za-z0-9_]*(=[A-Za-z0-9_.]+)?$");
-  if (!trivial.find(def.c_str())) {
+  if (!trivial.find(def)) {
     // This definition has a non-trivial value.
     switch (this->GetPolicyStatus(cmPolicies::CMP0005)) {
       case cmPolicies::WARN:
@@ -1409,9 +1410,9 @@ void cmMakefile::Configure()
   // make sure the CMakeFiles dir is there
   std::string filesDir = this->StateSnapshot.GetDirectory().GetCurrentBinary();
   filesDir += cmake::GetCMakeFilesDirectory();
-  cmSystemTools::MakeDirectory(filesDir.c_str());
+  cmSystemTools::MakeDirectory(filesDir);
 
-  assert(cmSystemTools::FileExists(currentStart.c_str(), true));
+  assert(cmSystemTools::FileExists(currentStart, true));
   this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentStart.c_str());
 
   cmListFile listFile;
@@ -1572,7 +1573,7 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath,
   newSnapshot.GetDirectory().SetCurrentSource(srcPath);
   newSnapshot.GetDirectory().SetCurrentBinary(binPath);
 
-  cmSystemTools::MakeDirectory(binPath.c_str());
+  cmSystemTools::MakeDirectory(binPath);
 
   cmMakefile* subMf = new cmMakefile(this->GlobalGenerator, newSnapshot);
   this->GetGlobalGenerator()->AddMakefile(subMf);
@@ -1876,7 +1877,7 @@ cmTarget* cmMakefile::AddLibrary(const std::string& lname,
   return target;
 }
 
-cmTarget* cmMakefile::AddExecutable(const char* exeName,
+cmTarget* cmMakefile::AddExecutable(const std::string& exeName,
                                     const std::vector<std::string>& srcs,
                                     bool excludeFromAll)
 {
@@ -1936,7 +1937,7 @@ cmSourceFile* cmMakefile::GetSourceFileWithOutput(
 {
   // If the queried path is not absolute we use the backward compatible
   // linear-time search for an output with a matching suffix.
-  if (!cmSystemTools::FileIsFullPath(name.c_str())) {
+  if (!cmSystemTools::FileIsFullPath(name)) {
     return this->LinearGetSourceFileWithOutput(name);
   }
   // Otherwise we use an efficient lookup map.
@@ -2055,7 +2056,7 @@ cmSourceGroup* cmMakefile::GetOrCreateSourceGroup(const std::string& name)
  * inherited ones.
  */
 cmSourceGroup* cmMakefile::FindSourceGroup(
-  const char* source, std::vector<cmSourceGroup>& groups) const
+  const std::string& source, std::vector<cmSourceGroup>& groups) const
 {
   // First search for a group that lists the file explicitly.
   for (std::vector<cmSourceGroup>::reverse_iterator sg = groups.rbegin();
@@ -3232,7 +3233,7 @@ int cmMakefile::TryCompile(const std::string& srcdir,
   this->IsSourceFileTryCompile = fast;
   // does the binary directory exist ? If not create it...
   if (!cmSystemTools::FileIsDirectory(bindir)) {
-    cmSystemTools::MakeDirectory(bindir.c_str());
+    cmSystemTools::MakeDirectory(bindir);
   }
 
   // change to the tests directory and run cmake
@@ -3410,7 +3411,7 @@ std::string cmMakefile::GetModulesFile(const char* filename) const
       cmSystemTools::ConvertToUnixSlashes(itempl);
       itempl += "/";
       itempl += filename;
-      if (cmSystemTools::FileExists(itempl.c_str())) {
+      if (cmSystemTools::FileExists(itempl)) {
         moduleInCMakeModulePath = itempl;
         break;
       }
@@ -3422,7 +3423,7 @@ std::string cmMakefile::GetModulesFile(const char* filename) const
   moduleInCMakeRoot += "/Modules/";
   moduleInCMakeRoot += filename;
   cmSystemTools::ConvertToUnixSlashes(moduleInCMakeRoot);
-  if (!cmSystemTools::FileExists(moduleInCMakeRoot.c_str())) {
+  if (!cmSystemTools::FileExists(moduleInCMakeRoot)) {
     moduleInCMakeRoot.clear();
   }
 
@@ -3554,11 +3555,11 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile,
   this->AddCMakeOutputFile(soutfile);
 
   mode_t perm = 0;
-  cmSystemTools::GetPermissions(sinfile.c_str(), perm);
+  cmSystemTools::GetPermissions(sinfile, perm);
   std::string::size_type pos = soutfile.rfind('/');
   if (pos != std::string::npos) {
     std::string path = soutfile.substr(0, pos);
-    cmSystemTools::MakeDirectory(path.c_str());
+    cmSystemTools::MakeDirectory(path);
   }
 
   if (copyonly) {
@@ -3618,7 +3619,7 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile,
                                             soutfile.c_str())) {
       res = 0;
     } else {
-      cmSystemTools::SetPermissions(soutfile.c_str(), perm);
+      cmSystemTools::SetPermissions(soutfile, perm);
     }
     cmSystemTools::RemoveFile(tempOutputFile);
   }
@@ -3707,7 +3708,7 @@ void cmMakefile::AddCMakeDependFilesFromUser()
     cmSystemTools::ExpandListArgument(deps_str, deps);
   }
   for (std::string const& dep : deps) {
-    if (cmSystemTools::FileIsFullPath(dep.c_str())) {
+    if (cmSystemTools::FileIsFullPath(dep)) {
       this->AddCMakeDependFile(dep);
     } else {
       std::string f = this->GetCurrentSourceDirectory();
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index f06e2ff..2721277 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -180,7 +180,7 @@ public:
   /**
    * Add an executable to the build.
    */
-  cmTarget* AddExecutable(const char* exename,
+  cmTarget* AddExecutable(const std::string& exename,
                           const std::vector<std::string>& srcs,
                           bool excludeFromAll = false);
 
@@ -516,7 +516,7 @@ public:
   /**
    * find what source group this source is in
    */
-  cmSourceGroup* FindSourceGroup(const char* source,
+  cmSourceGroup* FindSourceGroup(const std::string& source,
                                  std::vector<cmSourceGroup>& groups) const;
 #endif
 
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 1b09600..0ea8976 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1366,7 +1366,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
        si != sources.end(); ++si) {
     std::string const& source = si->Source->GetFullPath();
     cmSourceGroup* sourceGroup =
-      this->Makefile->FindSourceGroup(source.c_str(), sourceGroups);
+      this->Makefile->FindSourceGroup(source, sourceGroups);
     groupsUsed.insert(sourceGroup);
   }
 
@@ -1538,7 +1538,7 @@ void cmVisualStudio10TargetGenerator::WriteGroupSources(
     cmSourceFile const* sf = s.SourceFile;
     std::string const& source = sf->GetFullPath();
     cmSourceGroup* sourceGroup =
-      this->Makefile->FindSourceGroup(source.c_str(), sourceGroups);
+      this->Makefile->FindSourceGroup(source, sourceGroups);
     std::string const& filter = sourceGroup->GetFullName();
     this->WriteString("<", 2);
     std::string path = this->ConvertPath(source, s.RelativePath);

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

Summary of changes:
 Source/cmAddExecutableCommand.cxx          |    2 +-
 Source/cmExtraEclipseCDT4Generator.cxx     |    2 +-
 Source/cmGhsMultiTargetGenerator.cxx       |    4 +--
 Source/cmLocalVisualStudio7Generator.cxx   |    2 +-
 Source/cmMakefile.cxx                      |   43 ++++++++++++++--------------
 Source/cmMakefile.h                        |    4 +--
 Source/cmVisualStudio10TargetGenerator.cxx |    4 +--
 7 files changed, 31 insertions(+), 30 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list