--- cmake-3.9.3/Source/kwsys/SystemInformation.cxx.orig 2017-09-20 07:49:56.000000000 -0400 +++ cmake-3.9.3/Source/kwsys/SystemInformation.cxx 2017-10-02 19:49:32.889689400 -0400 @@ -872,7 +872,7 @@ void SystemInformation::RunMemoryCheck() // Hide implementation details in an anonymous namespace. namespace { // ***************************************************************************** -#if defined(__linux) || defined(__APPLE__) +#if defined(__linux) || defined(__APPLE__) || defined(__CYGWIN__) int LoadLines(FILE* file, std::vector& lines) { // Load each line in the given file into a the vector. @@ -902,7 +902,7 @@ int LoadLines(FILE* file, std::vector& lines) { @@ -935,7 +935,7 @@ int NameValue(std::vector c } #endif -#if defined(__linux) +#if defined(__linux) || defined(__CYGWIN__) || defined(__MSYS__) // **************************************************************************** template int GetFieldsFromFile(const char* fileName, const char** fieldNames, T* values) @@ -1531,7 +1531,7 @@ void SystemInformationImplementation::Ru this->QueryBSDProcessor(); #elif defined(__hpux) this->QueryHPUXProcessor(); -#elif defined(__linux) || defined(__CYGWIN__) +#elif defined(__linux) || defined(__CYGWIN__) || defined(__MSYS__) this->RetreiveInformationFromCpuInfoFile(); #else this->QueryProcessor(); @@ -1556,7 +1556,7 @@ void SystemInformationImplementation::Ru #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(); @@ -3599,7 +3599,7 @@ SystemInformationImplementation::GetHost GlobalMemoryStatusEx(&statex); return statex.ullTotalPhys / 1024; #endif -#elif defined(__linux) +#elif defined(__linux) || defined(__CYGWIN__) SystemInformation::LongLong memTotal = 0; int ierr = GetFieldFromFile("/proc/meminfo", "MemTotal:", memTotal); if (ierr) { @@ -3724,7 +3724,7 @@ SystemInformationImplementation::GetHost GlobalMemoryStatusEx(&statex); return (statex.ullTotalPhys - statex.ullAvailPhys) / 1024; #endif -#elif defined(__linux) +#elif defined(__linux) || defined(__CYGWIN__) // 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) }; @@ -3787,7 +3787,7 @@ SystemInformationImplementation::GetProc return -2; } return pmc.WorkingSetSize / 1024; -#elif defined(__linux) +#elif defined(__linux) || defined(__CYGWIN__) SystemInformation::LongLong memUsed = 0; int ierr = GetFieldFromFile("/proc/self/status", "VmRSS:", memUsed); if (ierr) { @@ -3863,7 +3863,7 @@ SystemInformation::LongLong SystemInform { #if defined(_WIN32) return GetCurrentProcessId(); -#elif defined(__linux) || defined(__APPLE__) +#elif defined(__linux) || defined(__APPLE__) || defined(__CYGWIN__) || defined(__MSYS__) return getpid(); #else return -1; @@ -4129,7 +4129,7 @@ bool SystemInformationImplementation::Qu 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.