Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Patch to compile CMake from source for specific version v3.20.5 via mingw64 to work with pre-built mingw64 of ncurses
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a2fcf2e372..4b78f9ee01 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -656,6 +656,9 @@ macro (CMAKE_BUILD_UTILITIES)
endif()
#---------------------------------------------------------------------
+ set(CURSES_INCLUDE_PATH "/usr/x86_64-w64-mingw32/include/ncursesw")
+ set(CURSES_LIBRARY "/usr/x86_64-w64-mingw32/lib/libncursesw.a;/usr/x86_64-w64-mingw32/lib/libformw.a")
+
# Use curses?
if (UNIX)
if(NOT DEFINED BUILD_CursesDialog)
@@ -665,8 +668,14 @@ macro (CMAKE_BUILD_UTILITIES)
else ()
set(BUILD_CursesDialog 0)
endif ()
+
+ set(BUILD_CursesDialog 1)
if(BUILD_CursesDialog)
set(CURSES_NEED_NCURSES TRUE)
+ set(CURSES_NEED_WIDE TRUE) # need wide as we have only wide-version of library
+ set(CURSES_INCLUDE_PATH "/usr/x86_64-w64-mingw32/include/ncursesw")
+ set(CURSES_LIBRARY "/usr/x86_64-w64-mingw32/lib/libncursesw.dll.a;/usr/x86_64-w64-mingw32/lib/libformw.dll.a")
+
find_package(Curses)
if(NOT CURSES_FOUND)
message(WARNING
diff --git a/Source/Checks/Curses/CMakeLists.txt b/Source/Checks/Curses/CMakeLists.txt
index 17318a33b2..4fffa5bba9 100644
--- a/Source/Checks/Curses/CMakeLists.txt
+++ b/Source/Checks/Curses/CMakeLists.txt
@@ -5,6 +5,10 @@ endif()
project(CheckCurses C)
set(CURSES_NEED_NCURSES TRUE)
+set(CURSES_NEED_WIDE TRUE) # set to true as we only have wide-version of library
+set(CURSES_INCLUDE_PATH "/usr/x86_64-w64-mingw32/include/ncursesw")
+set(CURSES_LIBRARY "/usr/x86_64-w64-mingw32/lib/libncursesw.dll.a;/usr/x86_64-w64-mingw32/lib/libformw.dll.a")
+
find_package(Curses)
if(NOT CURSES_FOUND)
return()
diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx
index 85e256b8bc..dbfec618e2 100644
--- a/Source/CursesDialog/ccmake.cxx
+++ b/Source/CursesDialog/ccmake.cxx
@@ -74,7 +74,7 @@ void onsig(int /*unused*/)
cmCursesForm::CurrentForm->Render(1, 1, x, y);
cmCursesForm::CurrentForm->UpdateStatusBar();
}
- signal(SIGWINCH, onsig);
+ signal(28, onsig);
}
}
@@ -142,7 +142,7 @@ int main(int argc, char const* const* argv)
keypad(stdscr, true); /* Use key symbols as KEY_DOWN */
cmCursesColor::InitColors();
- signal(SIGWINCH, onsig);
+ signal(28, onsig);
int x;
int y;
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index c23ee94511..a727ac3268 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -3,7 +3,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGlobalVisualStudioGenerator.h"
-#include <future>
+#include <mingw-std-threads/mingw.future.h>
#include <iostream>
#include <cm/iterator>
diff --git a/Source/cmQtAutoGenerator.h b/Source/cmQtAutoGenerator.h
index 5c3a8adccb..d0d9d3e180 100644
--- a/Source/cmQtAutoGenerator.h
+++ b/Source/cmQtAutoGenerator.h
@@ -5,7 +5,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include <istream>
-#include <mutex>
+#include <mingw-std-threads/mingw.mutex.h>
#include <string>
#include <unordered_set>
#include <vector>
diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx
index f5831628d3..c8204a1610 100644
--- a/Source/cmQtAutoMocUic.cxx
+++ b/Source/cmQtAutoMocUic.cxx
@@ -6,7 +6,7 @@
#include <atomic>
#include <cstddef>
#include <map>
-#include <mutex>
+#include <mingw-std-threads/mingw.mutex.h>
#include <set>
#include <string>
#include <unordered_map>
diff --git a/Source/cmUVHandlePtr.cxx b/Source/cmUVHandlePtr.cxx
index 8ea19423da..4f2346ad53 100644
--- a/Source/cmUVHandlePtr.cxx
+++ b/Source/cmUVHandlePtr.cxx
@@ -5,7 +5,7 @@
#include <cassert>
#include <cstdlib>
-#include <mutex>
+#include <mingw-std-threads/mingw.mutex.h>
#include <cm3p/uv.h>
diff --git a/Source/cmWorkerPool.cxx b/Source/cmWorkerPool.cxx
index 1d15c27adb..c02a4bdb6e 100644
--- a/Source/cmWorkerPool.cxx
+++ b/Source/cmWorkerPool.cxx
@@ -4,12 +4,12 @@
#include <algorithm>
#include <array>
-#include <condition_variable>
+#include <mingw-std-threads/mingw.condition_variable.h>
#include <cstddef>
#include <deque>
#include <functional>
-#include <mutex>
-#include <thread>
+#include <mingw-std-threads/mingw.mutex.h>
+#include <mingw-std-threads/mingw.thread.h>
#include <cm/memory>
diff --git a/Tests/CMakeLib/testUVProcessChainHelper.cxx b/Tests/CMakeLib/testUVProcessChainHelper.cxx
index 9c258342eb..93431d8d91 100644
--- a/Tests/CMakeLib/testUVProcessChainHelper.cxx
+++ b/Tests/CMakeLib/testUVProcessChainHelper.cxx
@@ -5,7 +5,7 @@
#include <set>
#include <sstream>
#include <string>
-#include <thread>
+#include <mingw-std-threads/mingw.thread.h>
std::string getStdin()
{
diff --git a/Tests/CMakeLib/testUVRAII.cxx b/Tests/CMakeLib/testUVRAII.cxx
index 0607f449fa..c721814e2c 100644
--- a/Tests/CMakeLib/testUVRAII.cxx
+++ b/Tests/CMakeLib/testUVRAII.cxx
@@ -1,6 +1,6 @@
#include <chrono>
#include <iostream>
-#include <thread>
+#include <mingw-std-threads/mingw.thread.h>
#include <utility>
#include <cm3p/uv.h>
diff --git a/Tests/RunCMake/CTestResourceAllocation/ctresalloc.cxx b/Tests/RunCMake/CTestResourceAllocation/ctresalloc.cxx
index daf8a2d808..150148efa8 100644
--- a/Tests/RunCMake/CTestResourceAllocation/ctresalloc.cxx
+++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc.cxx
@@ -6,7 +6,7 @@
#include <map>
#include <set>
#include <string>
-#include <thread>
+#include <mingw-std-threads/mingw.thread.h>
#include <utility>
#include <vector>
diff --git a/Utilities/std/cm/shared_mutex b/Utilities/std/cm/shared_mutex
index a1204fa557..f13c99a75e 100644
--- a/Utilities/std/cm/shared_mutex
+++ b/Utilities/std/cm/shared_mutex
@@ -13,7 +13,7 @@
#endif
#if defined(CMake_HAVE_CXX_SHARED_LOCK)
-# include <shared_mutex> // IWYU pragma: export
+# include <mingw-std-threads/mingw.shared_mutex.h> // IWYU pragma: export
#endif
#if !defined(CMake_HAVE_CXX_SHARED_MUTEX)
# include <cm3p/uv.h>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment