diff --git a/configure b/configure
index 7a13a96c88..c5247f969f 100755
--- a/configure
+++ b/configure
@@ -120,6 +120,7 @@ AWKCOMMAND='
if ($0 == "WIN32" && "'$os'" != "MINGW" &&
"'$os'" != "CYGWIN" && "'$os'" != "MSVC") { next; }
if ($0 == "MSVC" && "'$os'" != "MSVC") { next; }
+ if ($0 == "MINGW" && "'$os'" != "MINGW") { next; }
if ($0 == "DIRECTMUSIC" && "'$with_direct_music'" == "0") { next; }
if ($0 == "FLUIDSYNTH" && "'$fluidsynth'" == "" ) { next; }
if ($0 == "USE_XAUDIO2" && "'$with_xaudio2'" == "0") { next; }
diff --git a/projects/generate b/projects/generate
index 2ab89e8f1b..0c4d6ff940 100755
--- a/projects/generate
+++ b/projects/generate
@@ -136,6 +136,7 @@ load_main_data() {
if ($0 == "WIN32" && "'$os'" != "MINGW" &&
"'$os'" != "CYGWIN" && "'$os'" != "MSVC" ) { next; }
if ($0 == "MSVC" && "'$os'" != "MSVC") { next; }
+ if ($0 == "MINGW" && "'$os'" != "MINGW") { next; }
if ($0 == "DIRECTMUSIC" && "'$enable_directmusic'" != "1") { next; }
if ($0 == "FLUIDSYNTH" && "'$enable_fluidsynth'" != "1") { next; }
if ($0 == "USE_XAUDIO2" && "'$with_xaudio2'" == "0") { next; }
diff --git a/projects/openttd_vs140.vcxproj b/projects/openttd_vs140.vcxproj
index e47e3c1793..58f9ac3967 100644
--- a/projects/openttd_vs140.vcxproj
+++ b/projects/openttd_vs140.vcxproj
@@ -1403,10 +1403,6 @@
-
-
-
-
diff --git a/projects/openttd_vs140.vcxproj.filters b/projects/openttd_vs140.vcxproj.filters
index 40f41c8cac..9913cc3230 100644
--- a/projects/openttd_vs140.vcxproj.filters
+++ b/projects/openttd_vs140.vcxproj.filters
@@ -3303,18 +3303,6 @@
Btree containers
-
- MinGW threading
-
-
- MinGW threading
-
-
- MinGW threading
-
-
- MinGW threading
-
diff --git a/projects/openttd_vs141.vcxproj b/projects/openttd_vs141.vcxproj
index 567ea87cab..bd6ed6a3c8 100644
--- a/projects/openttd_vs141.vcxproj
+++ b/projects/openttd_vs141.vcxproj
@@ -1403,10 +1403,6 @@
-
-
-
-
diff --git a/projects/openttd_vs141.vcxproj.filters b/projects/openttd_vs141.vcxproj.filters
index 40f41c8cac..9913cc3230 100644
--- a/projects/openttd_vs141.vcxproj.filters
+++ b/projects/openttd_vs141.vcxproj.filters
@@ -3303,18 +3303,6 @@
Btree containers
-
- MinGW threading
-
-
- MinGW threading
-
-
- MinGW threading
-
-
- MinGW threading
-
diff --git a/projects/openttd_vs142.vcxproj b/projects/openttd_vs142.vcxproj
index 5b078d7c80..7293e5eb4c 100644
--- a/projects/openttd_vs142.vcxproj
+++ b/projects/openttd_vs142.vcxproj
@@ -1403,10 +1403,6 @@
-
-
-
-
diff --git a/projects/openttd_vs142.vcxproj.filters b/projects/openttd_vs142.vcxproj.filters
index 40f41c8cac..9913cc3230 100644
--- a/projects/openttd_vs142.vcxproj.filters
+++ b/projects/openttd_vs142.vcxproj.filters
@@ -3303,18 +3303,6 @@
Btree containers
-
- MinGW threading
-
-
- MinGW threading
-
-
- MinGW threading
-
-
- MinGW threading
-
diff --git a/source.list b/source.list
index 7f46b5700b..9aa906d73b 100644
--- a/source.list
+++ b/source.list
@@ -1249,7 +1249,9 @@ scope_info.h
3rdparty/cpp-btree/safe_btree_set.h
# MinGW threading
-3rdparty/mingw-std-threads/mingw.condition_variable.h
-3rdparty/mingw-std-threads/mingw.mutex.h
-3rdparty/mingw-std-threads/mingw.shared_mutex.h
-3rdparty/mingw-std-threads/mingw.thread.h
+#if MINGW
+ 3rdparty/mingw-std-threads/mingw.condition_variable.h
+ 3rdparty/mingw-std-threads/mingw.mutex.h
+ 3rdparty/mingw-std-threads/mingw.shared_mutex.h
+ 3rdparty/mingw-std-threads/mingw.thread.h
+#end