[Cmake-commits] CMake branch, next, updated. v3.3.2-3350-gaa7274d

Brad King brad.king at kitware.com
Mon Sep 28 11:33:36 EDT 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  aa7274d72651c28dfa7f8791208fbe57d0f75c3f (commit)
       via  fa5284f07f20e6d62ca5d2dab36ecc48c0511eba (commit)
      from  42730ac4f6debc07e91c90718899ed29a841f460 (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=aa7274d72651c28dfa7f8791208fbe57d0f75c3f
commit aa7274d72651c28dfa7f8791208fbe57d0f75c3f
Merge: 42730ac fa5284f
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Sep 28 11:33:36 2015 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Mon Sep 28 11:33:36 2015 -0400

    Merge topic 'vs-old-rule-files' into next
    
    fa5284f0 VS: Prevent generated "rule" files from causing rebuilds


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fa5284f07f20e6d62ca5d2dab36ecc48c0511eba
commit fa5284f07f20e6d62ca5d2dab36ecc48c0511eba
Author:     Mike Pagel <Mike.Pagel at bmw.de>
AuthorDate: Mon Sep 28 15:33:10 2015 +0200
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Sep 28 10:58:57 2015 -0400

    VS: Prevent generated "rule" files from causing rebuilds
    
    When we generate a ".rule" file to attach a custom command in a VS IDE
    project, set the file timestamp to be old enough to prevent the rule
    from re-running due to its timestamp.

diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 92403e3..6c71313 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -9,6 +9,7 @@
   implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
   See the License for more information.
 ============================================================================*/
+#include "windows.h"
 #include "cmVisualStudio10TargetGenerator.h"
 #include "cmGlobalVisualStudio10Generator.h"
 #include "cmGeneratorTarget.h"
@@ -871,6 +872,9 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile const* source,
         fout << "# generated from CMake\n";
         fout.flush();
         fout.close();
+        // Force given file to have a very old timestamp, thus
+        // preventing dependent rebuilds.
+        this->ForceOld(sourcePath);
         }
       else
         {
@@ -3458,3 +3462,26 @@ cmVisualStudio10TargetGenerator
   this->WriteString("<None Include=\"", 2);
   (*this->BuildFileStream) << cmVS10EscapeXML(keyFile) << "\" />\n";
 }
+
+bool cmVisualStudio10TargetGenerator::ForceOld(const std::string& source) const
+{
+  HANDLE h = CreateFileW(
+    cmSystemTools::ConvertToWindowsExtendedPath(source).c_str(),
+    FILE_WRITE_ATTRIBUTES,
+    FILE_SHARE_WRITE, 0, OPEN_EXISTING,
+    FILE_FLAG_BACKUP_SEMANTICS, 0);
+  if (!h)
+    {
+    return false;
+    }
+
+  FILETIME const ftime_20010101 = { 3365781504, 29389701 };
+  if (!SetFileTime(h, &ftime_20010101, &ftime_20010101, &ftime_20010101))
+    {
+    CloseHandle(h);
+    return false;
+    }
+
+  CloseHandle(h);
+  return true;
+}
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index 5fadb60..f2aaf05 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -130,6 +130,8 @@ private:
   cmIDEFlagTable const* GetLinkFlagTable() const;
   cmIDEFlagTable const* GetMasmFlagTable() const;
 
+  bool ForceOld(const std::string& source) const;
+
 private:
   typedef cmVisualStudioGeneratorOptions Options;
   typedef std::map<std::string, Options*> OptionsMap;

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

Summary of changes:
 Source/cmVisualStudio10TargetGenerator.cxx |   27 +++++++++++++++++++++++++++
 Source/cmVisualStudio10TargetGenerator.h   |    2 ++
 2 files changed, 29 insertions(+)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list