diff -aur cmake-3.5.2/Source/kwsys/SystemInformation.cxx.orig cmake-3.5.2/Source/kwsys/SystemInformation.cxx --- cmake-3.6.0/Source/kwsys/SystemInformation.cxx.orig 2016-07-07 10:47:27.000000000 -0400 +++ cmake-3.6.0/Source/kwsys/SystemInformation.cxx 2016-07-22 09:17:19.386054600 -0400 @@ -916,7 +916,7 @@ // Hide implementation details in an anonymous namespace. namespace { // ***************************************************************************** -#if defined(__linux) || defined(__APPLE__) +#if defined(__linux) || defined(__APPLE__) || defined(__CYGWIN__) || defined(__MSYS__) int LoadLines( FILE *file, std::vector &lines) @@ -952,7 +952,7 @@ return nRead; } -# if defined(__linux) +# if defined(__linux) || defined(__CYGWIN__) || defined(__MSYS__) // ***************************************************************************** int LoadLines( const char *fileName, @@ -991,7 +991,7 @@ } #endif -#if defined(__linux) +#if defined(__linux) || defined(__CYGWIN__) || defined(__MSYS__) // **************************************************************************** template int GetFieldsFromFile( @@ -1071,7 +1071,7 @@ #endif // **************************************************************************** -#if !defined(_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__) +#if !defined(_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(__MSYS__) void StacktraceSignalHandler( int sigNo, siginfo_t *sigInfo, @@ -1496,7 +1496,7 @@ #endif // don't define this class if we're not using it // -------------------------------------------------------------------------- -#if defined(_WIN32) || defined(__CYGWIN__) +#if defined(_WIN32) || defined(__CYGWIN__) || defined(__MSYS__) # define KWSYS_SYSTEMINFORMATION_USE_GetSystemTimes #endif #if defined(_MSC_VER) && _MSC_VER < 1310 @@ -1640,7 +1640,7 @@ this->QueryBSDProcessor(); #elif defined(__hpux) this->QueryHPUXProcessor(); -#elif defined(__linux) || defined(__CYGWIN__) +#elif defined(__linux) || defined(__CYGWIN__) || defined(__MSYS__) this->RetreiveInformationFromCpuInfoFile(); #else this->QueryProcessor(); @@ -1664,7 +1664,7 @@ this->QueryQNXMemory(); #elif defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) this->QueryBSDMemory(); -#elif defined(__CYGWIN__) +#elif defined(__CYGWIN__) || defined(__MSYS__) this->QueryCygwinMemory(); #elif defined(_WIN32) this->QueryWindowsMemory(); @@ -3199,7 +3199,6 @@ pos = buffer.find("processor\t",pos+1); } -#ifdef __linux // Find the largest physical id. int maxId = -1; std::string idc = @@ -3232,14 +3231,6 @@ atoi(this->ExtractValueFromCpuInfoFile(buffer,"ncpus active").c_str()); } -#else // __CYGWIN__ - // does not have "physical id" entries, neither "cpu cores" - // this has to be fixed for hyper-threading. - std::string cpucount = - this->ExtractValueFromCpuInfoFile(buffer,"cpu count"); - this->NumberOfPhysicalCPU= - this->NumberOfLogicalCPU = atoi(cpucount.c_str()); -#endif // gotta have one, and if this is 0 then we get a / by 0n // better to have a bad answer than a crash if(this->NumberOfPhysicalCPU <= 0) @@ -3437,7 +3428,7 @@ GlobalMemoryStatusEx(&statex); return statex.ullTotalPhys/1024; # endif -#elif defined(__linux) +#elif defined(__linux) || defined(__CYGWIN__) || defined(__MSYS__) SystemInformation::LongLong memTotal=0; int ierr=GetFieldFromFile("/proc/meminfo","MemTotal:",memTotal); if (ierr) @@ -3568,7 +3559,7 @@ GlobalMemoryStatusEx(&statex); return (statex.ullTotalPhys - statex.ullAvailPhys)/1024; # endif -#elif defined(__linux) +#elif defined(__linux) || defined(__CYGWIN__) || defined(__MSYS__) // First try to use MemAvailable, but it only works on newer kernels const char *names2[3]={"MemTotal:","MemAvailable:",NULL}; SystemInformation::LongLong values2[2]={SystemInformation::LongLong(0)}; @@ -3638,7 +3629,7 @@ return -2; } return pmc.WorkingSetSize/1024; -#elif defined(__linux) +#elif defined(__linux) || defined(__CYGWIN__) || defined(__MSYS__) SystemInformation::LongLong memUsed=0; int ierr=GetFieldFromFile("/proc/self/status","VmRSS:",memUsed); if (ierr) @@ -3722,7 +3713,7 @@ { #if defined(_WIN32) return GetCurrentProcessId(); -#elif defined(__linux) || defined(__APPLE__) +#elif defined(__linux) || defined(__APPLE__) || defined(__CYGWIN__) || defined(__MSYS__) return getpid(); #else return -1; @@ -3782,7 +3773,7 @@ */ void SystemInformationImplementation::SetStackTraceOnError(int enable) { -#if !defined(_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__) +#if !defined(_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(__MSYS__) static int saOrigValid=0; static struct sigaction saABRTOrig; static struct sigaction saSEGVOrig; @@ -4006,7 +3997,7 @@ bool SystemInformationImplementation::QueryCygwinMemory() { -#ifdef __CYGWIN__ +#if defined __CYGWIN__ || defined __MSYS__ // _SC_PAGE_SIZE does return the mmap() granularity on Cygwin, // see http://cygwin.com/ml/cygwin/2006-06/msg00350.html // Therefore just use 4096 as the page size of Windows.