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  95d4a2d05562c5f0a4113527d31dadef4d7756bd (commit)
       via  054d626c9cca0facb372ba740b8a797d463141a3 (commit)
       via  5b96fd5b81bde4655e471a31bf0fc579c1d10136 (commit)
       via  5eaf1e1be289245267263536f5464e40d2a677c0 (commit)
       via  75692393628d757a3dadb090179e167cd9539e2f (commit)
      from  bbf48c494ad28d1c8ac5aa6e4cecb35c2cbf1b84 (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=95d4a2d05562c5f0a4113527d31dadef4d7756bd
commit 95d4a2d05562c5f0a4113527d31dadef4d7756bd
Merge: 054d626 7569239
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Tue Sep 10 14:59:21 2019 +0000
Commit:     Kitware Robot <kwro...@kitware.com>
CommitDate: Tue Sep 10 10:59:39 2019 -0400

    Merge topic 'move-setting-GENERATE-upfront'
    
    7569239362 cmMakefile: set GENERATED property of outputs upfront
    
    Acked-by: Kitware Robot <kwro...@kitware.com>
    Merge-request: !3789


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=054d626c9cca0facb372ba740b8a797d463141a3
commit 054d626c9cca0facb372ba740b8a797d463141a3
Merge: bbf48c4 5b96fd5
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Tue Sep 10 14:58:45 2019 +0000
Commit:     Kitware Robot <kwro...@kitware.com>
CommitDate: Tue Sep 10 10:58:53 2019 -0400

    Merge topic 'MoveIfDifferent'
    
    5b96fd5b81 use cmSystemTools::MoveFileIfDifferent()
    5eaf1e1be2 cmSystemTools: introduce MoveFileIfDifferent()
    
    Acked-by: Kitware Robot <kwro...@kitware.com>
    Merge-request: !3794


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5b96fd5b81bde4655e471a31bf0fc579c1d10136
commit 5b96fd5b81bde4655e471a31bf0fc579c1d10136
Author:     Rolf Eike Beer <e...@emlix.com>
AuthorDate: Mon Sep 9 10:34:08 2019 +0200
Commit:     Rolf Eike Beer <e...@emlix.com>
CommitDate: Mon Sep 9 10:34:08 2019 +0200

    use cmSystemTools::MoveFileIfDifferent()
    
    This is better than doing CopyFileIfDifferent() followed by RemoveFile() in
    two ways:
    
     - it is more efficient, as it avoids disk I/O for the data, even if the
       files here are usually small
     - it is atomic, so an abort during the copy will not leave a destination 
file
       with partial data behind

diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index b4706a3..f1c48cc 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -3417,8 +3417,7 @@ std::string cmGeneratorTarget::GetPchHeader(const 
std::string& config,
         file << pchEpilogue << "\n";
       }
     }
-    cmSystemTools::CopyFileIfDifferent(filename_tmp, filename);
-    cmSystemTools::RemoveFile(filename_tmp);
+    cmSystemTools::MoveFileIfDifferent(filename_tmp, filename);
   }
   return inserted.first->second;
 }
@@ -3451,8 +3450,7 @@ std::string cmGeneratorTarget::GetPchSource(const 
std::string& config,
       cmGeneratedFileStream file(filename_tmp);
       file << "/* generated by CMake */\n";
     }
-    cmSystemTools::CopyFileIfDifferent(filename_tmp, filename);
-    cmSystemTools::RemoveFile(filename_tmp);
+    cmSystemTools::MoveFileIfDifferent(filename_tmp, filename);
   }
   return inserted.first->second;
 }
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 9152e94..3d8c3fb 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -2275,8 +2275,7 @@ void cmLocalGenerator::AddUnityBuild(cmGeneratorTarget* 
target,
           }
         }
       }
-      cmSystemTools::CopyFileIfDifferent(filename_tmp, filename);
-      cmSystemTools::RemoveFile(filename_tmp);
+      cmSystemTools::MoveFileIfDifferent(filename_tmp, filename);
 
       target->AddSource(filename, true);
 
diff --git a/Source/cmUseMangledMesaCommand.cxx 
b/Source/cmUseMangledMesaCommand.cxx
index cfc00e8..1fd386b 100644
--- a/Source/cmUseMangledMesaCommand.cxx
+++ b/Source/cmUseMangledMesaCommand.cxx
@@ -98,7 +98,6 @@ void CopyAndFullPathMesaHeader(const std::string& source,
   // close the files before attempting to copy
   fin.close();
   fout.close();
-  cmSystemTools::CopyFileIfDifferent(tempOutputFile, outFile);
-  cmSystemTools::RemoveFile(tempOutputFile);
+  cmSystemTools::MoveFileIfDifferent(tempOutputFile, outFile);
 }
 }

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5eaf1e1be289245267263536f5464e40d2a677c0
commit 5eaf1e1be289245267263536f5464e40d2a677c0
Author:     Rolf Eike Beer <e...@emlix.com>
AuthorDate: Mon Sep 9 09:09:48 2019 +0200
Commit:     Rolf Eike Beer <e...@emlix.com>
CommitDate: Mon Sep 9 10:30:25 2019 +0200

    cmSystemTools: introduce MoveFileIfDifferent()

diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index b7287d9..074faa5 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -855,6 +855,18 @@ bool cmSystemTools::RenameFile(const std::string& oldname,
 #endif
 }
 
+void cmSystemTools::MoveFileIfDifferent(const std::string& source,
+                                        const std::string& destination)
+{
+  if (FilesDiffer(source, destination)) {
+    if (RenameFile(source, destination)) {
+      return;
+    }
+    CopyFileAlways(source, destination);
+  }
+  RemoveFile(source);
+}
+
 std::string cmSystemTools::ComputeFileHash(const std::string& source,
                                            cmCryptoHash::Algo algo)
 {
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index 863db3f..8ca4939 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -131,6 +131,10 @@ public:
   static bool RenameFile(const std::string& oldname,
                          const std::string& newname);
 
+  //! Rename a file if contents are different, delete the source otherwise
+  static void MoveFileIfDifferent(const std::string& source,
+                                  const std::string& destination);
+
   //! Compute the hash of a file
   static std::string ComputeFileHash(const std::string& source,
                                      cmCryptoHash::Algo algo);

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=75692393628d757a3dadb090179e167cd9539e2f
commit 75692393628d757a3dadb090179e167cd9539e2f
Author:     Daniel Eiband <daniel.eib...@brainlab.com>
AuthorDate: Fri Sep 6 19:17:37 2019 +0200
Commit:     Daniel Eiband <daniel.eib...@brainlab.com>
CommitDate: Fri Sep 6 22:22:22 2019 +0200

    cmMakefile: set GENERATED property of outputs upfront
    
    Setting the GENERATED property of outputs upfront is a precondition for 
delayed
    custom command creation (generator expressions in outputs).
    
    Issue: 12877

diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 411add3..d729451 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -860,7 +860,7 @@ void cmMakefile::AddCustomCommandToTarget(
         e << "No TARGET '" << target
           << "' has been created in this directory.";
       }
-      IssueMessage(messageType, e.str());
+      this->IssueMessage(messageType, e.str());
     }
 
     return;
@@ -886,11 +886,7 @@ void cmMakefile::AddCustomCommandToTarget(
   }
 
   // Always create the byproduct sources and mark them generated.
-  for (std::string const& o : byproducts) {
-    if (cmSourceFile* out = this->GetOrCreateSource(o, true)) {
-      out->SetProperty("GENERATED", "1");
-    }
-  }
+  this->CreateGeneratedSources(byproducts);
 
   // Add the command to the appropriate build step for the target.
   std::vector<std::string> no_output;
@@ -940,6 +936,10 @@ cmSourceFile* cmMakefile::AddCustomCommandToOutput(
     }
   }
 
+  // Always create the output sources and mark them generated.
+  this->CreateGeneratedSources(outputs, cmSourceFileLocationKind::Known);
+  this->CreateGeneratedSources(byproducts, cmSourceFileLocationKind::Known);
+
   // Choose a source file on which to store the custom command.
   cmSourceFile* file = nullptr;
   if (!commandLines.empty() && !main_dependency.empty()) {
@@ -987,20 +987,6 @@ cmSourceFile* cmMakefile::AddCustomCommandToOutput(
     file->SetProperty("__CMAKE_RULE", "1");
   }
 
-  // Always create the output sources and mark them generated.
-  for (std::string const& o : outputs) {
-    if (cmSourceFile* out =
-          this->GetOrCreateSource(o, true, cmSourceFileLocationKind::Known)) {
-      out->SetProperty("GENERATED", "1");
-    }
-  }
-  for (std::string const& o : byproducts) {
-    if (cmSourceFile* out =
-          this->GetOrCreateSource(o, true, cmSourceFileLocationKind::Known)) {
-      out->SetProperty("GENERATED", "1");
-    }
-  }
-
   // Attach the custom command to the file.
   if (file) {
     // Construct a complete list of dependencies.
@@ -1180,6 +1166,7 @@ cmTarget* cmMakefile::AddUtilityCommand(
   if (excludeFromAll || this->GetPropertyAsBool("EXCLUDE_FROM_ALL")) {
     target->SetProperty("EXCLUDE_FROM_ALL", "TRUE");
   }
+
   if (!comment) {
     // Use an empty comment to avoid generation of default comment.
     comment = "";
@@ -1187,6 +1174,9 @@ cmTarget* cmMakefile::AddUtilityCommand(
 
   // Store the custom command in the target.
   if (!commandLines.empty() || !depends.empty()) {
+    // Always create the byproduct sources and mark them generated.
+    this->CreateGeneratedSources(byproducts, cmSourceFileLocationKind::Known);
+
     std::string force =
       cmStrCat(this->GetCurrentBinaryDirectory(), "/CMakeFiles/", utilityName);
     std::vector<std::string> forced;
@@ -1205,14 +1195,6 @@ cmTarget* cmMakefile::AddUtilityCommand(
     } else {
       cmSystemTools::Error("Could not get source file entry for " + force);
     }
-
-    // Always create the byproduct sources and mark them generated.
-    for (std::string const& byproduct : byproducts) {
-      if (cmSourceFile* out = this->GetOrCreateSource(
-            byproduct, true, cmSourceFileLocationKind::Known)) {
-        out->SetProperty("GENERATED", "1");
-      }
-    }
   }
   return target;
 }
@@ -3325,6 +3307,16 @@ cmSourceFile* cmMakefile::GetOrCreateSource(const 
std::string& sourceName,
   return this->CreateSource(sourceName, generated, kind);
 }
 
+void cmMakefile::CreateGeneratedSources(
+  const std::vector<std::string>& outputs, cmSourceFileLocationKind kind)
+{
+  for (std::string const& output : outputs) {
+    if (cmSourceFile* out = this->GetOrCreateSource(output, true, kind)) {
+      out->SetProperty("GENERATED", "1");
+    }
+  }
+}
+
 void cmMakefile::AddTargetObject(std::string const& tgtName,
                                  std::string const& objFile)
 {
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 09f53c9..52464d6 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -1030,6 +1030,11 @@ private:
                                          bool escapeQuotes, bool noEscapes,
                                          bool atOnly, const char* filename,
                                          long line, bool replaceAt) const;
+
+  void CreateGeneratedSources(
+    const std::vector<std::string>& outputs,
+    cmSourceFileLocationKind kind = cmSourceFileLocationKind::Ambiguous);
+
   /**
    * Old version of GetSourceFileWithOutput(const std::string&) kept for
    * backward-compatibility. It implements a linear search and support

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

Summary of changes:
 Source/cmGeneratorTarget.cxx       |  6 ++---
 Source/cmLocalGenerator.cxx        |  3 +--
 Source/cmMakefile.cxx              | 48 ++++++++++++++++----------------------
 Source/cmMakefile.h                |  5 ++++
 Source/cmSystemTools.cxx           | 12 ++++++++++
 Source/cmSystemTools.h             |  4 ++++
 Source/cmUseMangledMesaCommand.cxx |  3 +--
 7 files changed, 45 insertions(+), 36 deletions(-)


hooks/post-receive
-- 
CMake
_______________________________________________
Cmake-commits mailing list
Cmake-commits@cmake.org
https://cmake.org/mailman/listinfo/cmake-commits

Reply via email to