[Cmake-commits] CMake branch, next, updated. v3.2.2-3223-g4555dd8

Brad King brad.king at kitware.com
Thu May 28 08:49:52 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  4555dd8042e869a77fe56d3b43fae5452649b31f (commit)
       via  bf365792a11ce84426c8fc61738891c8e14fee43 (commit)
       via  ee71b75133d3e515172b5fbe3dccf7d3906f5a19 (commit)
       via  2d4bef07d9450984bd865eae44192a2137ad899e (commit)
      from  fb154f79c274e74e2dc09bc175a1ed04d113cbdd (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=4555dd8042e869a77fe56d3b43fae5452649b31f
commit 4555dd8042e869a77fe56d3b43fae5452649b31f
Merge: fb154f7 bf36579
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu May 28 08:49:51 2015 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu May 28 08:49:51 2015 -0400

    Merge topic 'update-kwsys' into next
    
    bf365792 Merge branch 'upstream-kwsys' into update-kwsys
    ee71b751 KWSys 2015-05-27 (61e0419f)
    2d4bef07 CMake Nightly Date Stamp


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bf365792a11ce84426c8fc61738891c8e14fee43
commit bf365792a11ce84426c8fc61738891c8e14fee43
Merge: 2d4bef0 ee71b75
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu May 28 08:21:55 2015 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu May 28 08:21:55 2015 -0400

    Merge branch 'upstream-kwsys' into update-kwsys


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ee71b75133d3e515172b5fbe3dccf7d3906f5a19
commit ee71b75133d3e515172b5fbe3dccf7d3906f5a19
Author:     KWSys Robot <kwrobot at kitware.com>
AuthorDate: Wed May 27 13:15:22 2015 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu May 28 08:21:52 2015 -0400

    KWSys 2015-05-27 (61e0419f)
    
    Extract upstream KWSys using the following shell commands.
    
    $ git archive --prefix=upstream-kwsys/ 61e0419f | tar x
    $ git shortlog --no-merges --abbrev=8 --format='%h %s' b1d560a0..61e0419f
    Brad King (1):
          61e0419f SystemTools: Teach RemoveFile to tolerate missing file
    
    Matt McCormick (1):
          9a6b7c3f cmake: Set CMP0056 to NEW

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8069ee2..c88e888 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -88,6 +88,9 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6.3 FATAL_ERROR)
 IF(POLICY CMP0025)
   CMAKE_POLICY(SET CMP0025 NEW)
 ENDIF()
+IF(POLICY CMP0056)
+  CMAKE_POLICY(SET CMP0056 NEW)
+ENDIF()
 
 #-----------------------------------------------------------------------------
 # If a namespace is not specified, use "kwsys" and enable testing.
diff --git a/SystemTools.cxx b/SystemTools.cxx
index 6c4a7a6..c834e34 100644
--- a/SystemTools.cxx
+++ b/SystemTools.cxx
@@ -2674,27 +2674,43 @@ kwsys_stl::string SystemTools::GetLastSystemError()
 bool SystemTools::RemoveFile(const kwsys_stl::string& source)
 {
 #ifdef _WIN32
+  kwsys_stl::wstring const& ws =
+    SystemTools::ConvertToWindowsExtendedPath(source);
+  if (DeleteFileW(ws.c_str()))
+    {
+    return true;
+    }
+  DWORD err = GetLastError();
+  if (err == ERROR_FILE_NOT_FOUND ||
+      err == ERROR_PATH_NOT_FOUND)
+    {
+    return true;
+    }
+  if (err != ERROR_ACCESS_DENIED)
+    {
+    return false;
+    }
+  /* The file may be read-only.  Try adding write permission.  */
   mode_t mode;
-  if ( !SystemTools::GetPermissions(source, mode) )
+  if (!SystemTools::GetPermissions(source, mode) ||
+      !SystemTools::SetPermissions(source, S_IWRITE))
     {
+    SetLastError(err);
     return false;
     }
-  /* Win32 unlink is stupid --- it fails if the file is read-only  */
-  SystemTools::SetPermissions(source, S_IWRITE);
-#endif
-#ifdef _WIN32
-  bool res =
-    _wunlink(SystemTools::ConvertToWindowsExtendedPath(source).c_str()) == 0;
-#else
-  bool res = unlink(source.c_str()) != 0 ? false : true;
-#endif
-#ifdef _WIN32
-  if ( !res )
+  if (DeleteFileW(ws.c_str()) ||
+      GetLastError() == ERROR_FILE_NOT_FOUND ||
+      GetLastError() == ERROR_PATH_NOT_FOUND)
     {
-    SystemTools::SetPermissions(source, mode);
+    return true;
     }
+  /* Try to restore the original permissions.  */
+  SystemTools::SetPermissions(source, mode);
+  SetLastError(err);
+  return false;
+#else
+  return unlink(source.c_str()) == 0 || errno == ENOENT;
 #endif
-  return res;
 }
 
 bool SystemTools::RemoveADirectory(const kwsys_stl::string& source)
diff --git a/testSystemTools.cxx b/testSystemTools.cxx
index 42b6249..15d8eab 100644
--- a/testSystemTools.cxx
+++ b/testSystemTools.cxx
@@ -156,6 +156,24 @@ static bool CheckFileOperations()
     res = false;
     }
 
+  kwsys_stl::string const testFileMissing(testNewDir + "/testMissingFile.txt");
+  if (!kwsys::SystemTools::RemoveFile(testFileMissing))
+    {
+    std::string const& msg = kwsys::SystemTools::GetLastSystemError();
+    kwsys_ios::cerr <<
+      "RemoveFile(\"" << testFileMissing << "\") failed: " << msg << "\n";
+    res = false;
+    }
+
+  kwsys_stl::string const testFileMissingDir(testNewDir + "/missing/file.txt");
+  if (!kwsys::SystemTools::RemoveFile(testFileMissingDir))
+    {
+    std::string const& msg = kwsys::SystemTools::GetLastSystemError();
+    kwsys_ios::cerr <<
+      "RemoveFile(\"" << testFileMissingDir << "\") failed: " << msg << "\n";
+    res = false;
+    }
+
   kwsys::SystemTools::Touch(testNewFile.c_str(), true);
   if (!kwsys::SystemTools::RemoveADirectory(testNewDir))
     {

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

Summary of changes:
 Source/CMakeVersion.cmake        |    2 +-
 Source/kwsys/CMakeLists.txt      |    3 +++
 Source/kwsys/SystemTools.cxx     |   44 ++++++++++++++++++++++++++------------
 Source/kwsys/testSystemTools.cxx |   18 ++++++++++++++++
 4 files changed, 52 insertions(+), 15 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list