[Cmake-commits] CMake branch, next, updated. v3.8.0-733-gc8e214d

Kitware Robot kwrobot at kitware.com
Wed Apr 12 09:15:04 EDT 2017


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
  discards  f44256537e41aba15050a121e0b0aa9a45635749 (commit)
  discards  999e45c88dffd6634272008fcc2d7f982e52e1f4 (commit)
       via  c8e214d7d10cb60be3ca9d140ccdc01b4c78cff5 (commit)
       via  ada8e0cac4b50d07f4d07ecd584bf00e7afd3ac5 (commit)
       via  85841e8bd5e678f69271272db7f838f873347812 (commit)
       via  fddd559406558a2037733e5b760e9dd04e9edfd1 (commit)
       via  80ea73f288ab2ca89ecc3c775a321f01b8598b02 (commit)

This update added new revisions after undoing existing revisions.  That is
to say, the old revision is not a strict subset of the new revision.  This
situation occurs when you --force push a change and generate a repository
containing something like this:

 * -- * -- B -- O -- O -- O (f44256537e41aba15050a121e0b0aa9a45635749)
            \
             N -- N -- N (c8e214d7d10cb60be3ca9d140ccdc01b4c78cff5)

When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.

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=c8e214d7d10cb60be3ca9d140ccdc01b4c78cff5
commit c8e214d7d10cb60be3ca9d140ccdc01b4c78cff5
Merge: fddd559 ada8e0c
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Apr 12 13:14:24 2017 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Wed Apr 12 09:14:31 2017 -0400

    Stage topic 'update-kwsys'
    
    Topic-id: 23621
    Topic-url: https://gitlab.kitware.com/cmake/cmake/merge_requests/694


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ada8e0cac4b50d07f4d07ecd584bf00e7afd3ac5
commit ada8e0cac4b50d07f4d07ecd584bf00e7afd3ac5
Merge: fddd559 85841e8
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Apr 12 09:10:22 2017 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Apr 12 09:10:22 2017 -0400

    Merge branch 'upstream-KWSys' into update-kwsys
    
    * upstream-KWSys:
      KWSys 2017-04-12 (23a4c211)


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=85841e8bd5e678f69271272db7f838f873347812
commit 85841e8bd5e678f69271272db7f838f873347812
Author:     KWSys Upstream <kwrobot at kitware.com>
AuthorDate: Wed Apr 12 09:08:58 2017 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Apr 12 09:10:22 2017 -0400

    KWSys 2017-04-12 (23a4c211)
    
    Code extracted from:
    
        https://gitlab.kitware.com/utils/kwsys.git
    
    at commit 23a4c211e90c1cfd399c3632141dbd549a5db8cf (master).
    
    Upstream Shortlog
    -----------------
    
    Brad King (2):
          41a9dfef SystemInformation: Fix dynamic loader failure on WinXP SP2
          3ead6158 SystemTools: Fix stat() wrapper compilation with Borland
    
    Daniel Pfeifer (1):
          ce5b0d34 Disable include-what-you-use
    
    Mathieu Westphal (1):
          a2bf6bb3 SystemTools: Add cross-platform stat() wrapper

diff --git a/CMakeLists.txt b/CMakeLists.txt
index de68118..28fe9e7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -796,6 +796,8 @@ ENDFOREACH()
 IF(KWSYS_C_SRCS OR KWSYS_CXX_SRCS)
   ADD_LIBRARY(${KWSYS_NAMESPACE} ${KWSYS_LIBRARY_TYPE}
     ${KWSYS_C_SRCS} ${KWSYS_CXX_SRCS})
+  SET_PROPERTY(TARGET ${KWSYS_NAMESPACE} PROPERTY C_INCLUDE_WHAT_YOU_USE "")
+  SET_PROPERTY(TARGET ${KWSYS_NAMESPACE} PROPERTY CXX_INCLUDE_WHAT_YOU_USE "")
   SET_PROPERTY(TARGET ${KWSYS_NAMESPACE} PROPERTY LABELS ${KWSYS_LABELS_LIB})
   IF(KWSYS_USE_DynamicLoader)
     IF(UNIX)
@@ -940,6 +942,8 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
     ENDIF()
     IF(KWSYS_USE_ConsoleBuf)
       ADD_EXECUTABLE(testConsoleBufChild testConsoleBufChild.cxx)
+      SET_PROPERTY(TARGET testConsoleBufChild PROPERTY C_INCLUDE_WHAT_YOU_USE "")
+      SET_PROPERTY(TARGET testConsoleBufChild PROPERTY CXX_INCLUDE_WHAT_YOU_USE "")
       SET_PROPERTY(TARGET testConsoleBufChild PROPERTY LABELS ${KWSYS_LABELS_EXE})
       TARGET_LINK_LIBRARIES(testConsoleBufChild ${KWSYS_NAMESPACE})
       SET(KWSYS_CXX_TESTS ${KWSYS_CXX_TESTS}
@@ -967,6 +971,8 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
       ${KWSYS_CXX_TESTS}
       )
     ADD_EXECUTABLE(${KWSYS_NAMESPACE}TestsCxx ${KWSYS_CXX_TEST_SRCS})
+    SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}TestsCxx PROPERTY C_INCLUDE_WHAT_YOU_USE "")
+    SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}TestsCxx PROPERTY CXX_INCLUDE_WHAT_YOU_USE "")
     SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}TestsCxx PROPERTY LABELS ${KWSYS_LABELS_EXE})
     TARGET_LINK_LIBRARIES(${KWSYS_NAMESPACE}TestsCxx ${KWSYS_NAMESPACE})
 
diff --git a/SystemInformation.cxx b/SystemInformation.cxx
index 93312e9..70f1a43 100644
--- a/SystemInformation.cxx
+++ b/SystemInformation.cxx
@@ -4341,18 +4341,35 @@ unsigned char SystemInformationImplementation::GetAPICId()
 void SystemInformationImplementation::CPUCountWindows()
 {
 #if defined(_WIN32)
-  std::vector<SYSTEM_LOGICAL_PROCESSOR_INFORMATION> ProcInfo;
   this->NumberOfPhysicalCPU = 0;
   this->NumberOfLogicalCPU = 0;
 
+  typedef BOOL(WINAPI * GetLogicalProcessorInformationType)(
+    PSYSTEM_LOGICAL_PROCESSOR_INFORMATION, PDWORD);
+  static GetLogicalProcessorInformationType pGetLogicalProcessorInformation =
+    (GetLogicalProcessorInformationType)GetProcAddress(
+      GetModuleHandleW(L"kernel32"), "GetLogicalProcessorInformation");
+
+  if (!pGetLogicalProcessorInformation) {
+    // Fallback to approximate implementation on ancient Windows versions.
+    SYSTEM_INFO info;
+    ZeroMemory(&info, sizeof(info));
+    GetSystemInfo(&info);
+    this->NumberOfPhysicalCPU =
+      static_cast<unsigned int>(info.dwNumberOfProcessors);
+    this->NumberOfLogicalCPU = this->NumberOfPhysicalCPU;
+    return;
+  }
+
+  std::vector<SYSTEM_LOGICAL_PROCESSOR_INFORMATION> ProcInfo;
   {
     DWORD Length = 0;
-    DWORD rc = GetLogicalProcessorInformation(NULL, &Length);
+    DWORD rc = pGetLogicalProcessorInformation(NULL, &Length);
     assert(FALSE == rc);
     (void)rc; // Silence unused variable warning in Borland C++ 5.81
     assert(GetLastError() == ERROR_INSUFFICIENT_BUFFER);
     ProcInfo.resize(Length / sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION));
-    rc = GetLogicalProcessorInformation(&ProcInfo[0], &Length);
+    rc = pGetLogicalProcessorInformation(&ProcInfo[0], &Length);
     assert(rc != FALSE);
     (void)rc; // Silence unused variable warning in Borland C++ 5.81
   }
diff --git a/SystemTools.cxx b/SystemTools.cxx
index 65b7b26..100a49c 100644
--- a/SystemTools.cxx
+++ b/SystemTools.cxx
@@ -54,7 +54,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <sys/stat.h>
 #include <time.h>
 
 #if defined(_WIN32) && !defined(_MSC_VER) && defined(__GNUC__)
@@ -1258,6 +1257,38 @@ bool SystemTools::TestFileAccess(const std::string& filename,
 }
 
 //----------------------------------------------------------------------------
+int SystemTools::Stat(const char* path, SystemTools::Stat_t* buf)
+{
+  if (!path) {
+    errno = EFAULT;
+    return -1;
+  }
+  return SystemTools::Stat(std::string(path), buf);
+}
+
+//----------------------------------------------------------------------------
+int SystemTools::Stat(const std::string& path, SystemTools::Stat_t* buf)
+{
+  if (path.empty()) {
+    errno = ENOENT;
+    return -1;
+  }
+#if defined(_WIN32) && !defined(__CYGWIN__)
+  // Ideally we should use ConvertToWindowsExtendedPath to support
+  // long paths, but _wstat64 rejects paths with '?' in them, thinking
+  // they are wildcards.
+  std::wstring const& wpath = Encoding::ToWide(path);
+#if defined(__BORLANDC__)
+  return _wstati64(wpath.c_str(), buf);
+#else
+  return _wstat64(wpath.c_str(), buf);
+#endif
+#else
+  return stat(path.c_str(), buf);
+#endif
+}
+
+//----------------------------------------------------------------------------
 #ifdef __CYGWIN__
 bool SystemTools::PathCygwinToWin32(const char* path, char* win32_path)
 {
diff --git a/SystemTools.hxx.in b/SystemTools.hxx.in
index 7a5256b..53abce7 100644
--- a/SystemTools.hxx.in
+++ b/SystemTools.hxx.in
@@ -13,6 +13,9 @@
 #include <@KWSYS_NAMESPACE@/String.hxx>
 
 #include <sys/types.h>
+// include sys/stat.h after sys/types.h
+#include <sys/stat.h>
+
 #if !defined(_WIN32) || defined(__CYGWIN__)
 #include <unistd.h> // For access permissions for use with access()
 #endif
@@ -324,6 +327,27 @@ public:
                              TestFilePermissions permissions);
   static bool TestFileAccess(const std::string& filename,
                              TestFilePermissions permissions);
+/**
+ * Cross platform wrapper for stat struct
+ */
+#if defined(_WIN32) && !defined(__CYGWIN__)
+#if defined(__BORLANDC__)
+  typedef struct stati64 Stat_t;
+#else
+  typedef struct _stat64 Stat_t;
+#endif
+#else
+  typedef struct stat Stat_t;
+#endif
+
+  /**
+   * Cross platform wrapper for stat system call
+   *
+   * On Windows this may not work for paths longer than 250 characters
+   * due to limitations of the underlying '_wstat64' call.
+   */
+  static int Stat(const char* path, Stat_t* buf);
+  static int Stat(const std::string& path, Stat_t* buf);
 
 /**
  * Converts Cygwin path to Win32 path. Uses dictionary container for
diff --git a/testSystemTools.cxx b/testSystemTools.cxx
index 8e1ea25..9b08a04 100644
--- a/testSystemTools.cxx
+++ b/testSystemTools.cxx
@@ -135,6 +135,19 @@ static bool CheckFileOperations()
     res = false;
   }
 
+  kwsys::SystemTools::Stat_t buf;
+  if (kwsys::SystemTools::Stat(testTxtFile.c_str(), &buf) != 0) {
+    std::cerr << "Problem with Stat - unable to stat text file: "
+              << testTxtFile << std::endl;
+    res = false;
+  }
+
+  if (kwsys::SystemTools::Stat(testBinFile, &buf) != 0) {
+    std::cerr << "Problem with Stat - unable to stat bin file: " << testBinFile
+              << std::endl;
+    res = false;
+  }
+
   if (!kwsys::SystemTools::MakeDirectory(testNewDir)) {
     std::cerr << "Problem with MakeDirectory for: " << testNewDir << std::endl;
     res = false;

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

Summary of changes:
 Source/kwsys/CMakeLists.txt        |    6 ++++++
 Source/kwsys/SystemInformation.cxx |   23 ++++++++++++++++++++---
 Source/kwsys/SystemTools.cxx       |   33 ++++++++++++++++++++++++++++++++-
 Source/kwsys/SystemTools.hxx.in    |   24 ++++++++++++++++++++++++
 Source/kwsys/testSystemTools.cxx   |   13 +++++++++++++
 5 files changed, 95 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list