diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1ac592a..83121ed 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -50,7 +50,7 @@ ADD_CUSTOM_TARGET(uninstall
   "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
 
 # identify target architecture
-if(WIN32)
+if(MSVC)
     SET(SC_WIN_BUNDLE_NAME "SuperCollider" CACHE STRING "Folder name of SC install")
 
     if(CMAKE_SIZEOF_VOID_P EQUAL 8)
@@ -64,7 +64,7 @@ if(WIN32)
         SET(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/Install" CACHE PATH "Cmake install path" FORCE)
     endif()
 
-endif(WIN32)
+endif(MSVC)
 
 #############################################
 # Compiler flags etc
@@ -100,7 +100,7 @@ if (${CMAKE_COMPILER_IS_GNUCXX})
 			add_definitions("-fpascal-strings")
 		endif()
 		add_definitions("-D_REENTRANT")
-	elseif(NOT (WIN32 AND NOT CYGWIN))
+	elseif(NOT MSVC)
 		add_definitions("-pthread")
 	endif()
 
@@ -113,6 +113,16 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL
     set(CMAKE_COMPILER_IS_CLANG 1)
 endif()
 
+if(MINGW)
+    # Suppress some annoying warnings
+    add_compile_options(-Wno-deprecated-declarations -Wno-format)
+    if(CMAKE_COMPILER_IS_CLANG)
+        add_compile_options(-Wno-constant-conversion -Wno-enum-compare-switch -Wno-parentheses)
+    else()
+        add_compile_options(-Wno-ignored-attributes -Wno-overflow)
+    endif()
+endif()
+
 if(APPLE)
 	if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
 		set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/Install" CACHE STRING "Cmake install path" FORCE)
@@ -122,7 +132,7 @@ elseif(UNIX)
 endif()
 
 if(WIN32)
-    add_definitions(-DWIN32_LEAN_AND_MEAN -DNOMINMAX -D_WIN32_WINNT=0x0600)
+    add_definitions(-DWIN32_LEAN_AND_MEAN -DNOMINMAX)
 
     #avoid unnecesary autolink
     add_definitions(-DBOOST_DATE_TIME_NO_LIB -DBOOST_ALL_NO_LIB)
@@ -305,7 +315,7 @@ endif()
 #############################################
 # some default libraries
 
-if (NOT WIN32)
+if (NOT MSVC)
     find_package(Pthreads)
 
     if (NOT PTHREADS_FOUND)
@@ -489,7 +499,7 @@ add_subdirectory(lang)
 add_subdirectory(platform)
 add_subdirectory(editors)
 
-if(UNIX AND NOT APPLE)
+if((UNIX AND NOT APPLE) OR MINGW)
     install(DIRECTORY include/common include/plugin_interface include/server include/lang
         DESTINATION ${CMAKE_INSTALL_PREFIX}/include/SuperCollider
 	FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp"
@@ -499,10 +509,12 @@ if(UNIX AND NOT APPLE)
     )
 endif()
 
-if (WIN32)
+if (MSVC)
   set(auxresourcesdir "${SC_WIN_BUNDLE_NAME}" CACHE STRING "Resources directory")
 elseif(APPLE)
 	set(auxresourcesdir ${scappbundlename} CACHE STRING "Resources directory")
+elseif(MINGW)
+	set(auxresourcesdir "${CMAKE_INSTALL_PREFIX}/share/SuperCollider" CACHE STRING "Resources directory")
 else()
 	set(auxresourcesdir "share/SuperCollider" CACHE STRING "Resources directory")
 endif()
diff --git a/editors/sc-ide/CMakeLists.txt b/editors/sc-ide/CMakeLists.txt
index 569022b..20c1664 100644
--- a/editors/sc-ide/CMakeLists.txt
+++ b/editors/sc-ide/CMakeLists.txt
@@ -347,7 +347,7 @@ if(APPLE)
     target_link_libraries( libscide PUBLIC "-framework CoreServices -framework Foundation")
     target_link_libraries( libscide PUBLIC "-framework Cocoa" )
 elseif(WIN32)
-    target_link_libraries( libscide PUBLIC wsock32 )
+    target_link_libraries( libscide PUBLIC wsock32 shlwapi )
     target_compile_definitions( libscide PUBLIC UNICODE _UNICODE)
     # The following prevents a Windows console from showing up
     # when the executable is started:
@@ -402,7 +402,7 @@ if(APPLE)
     set_property(TARGET SuperCollider
 	    PROPERTY MACOSX_BUNDLE_BUNDLE_NAME ${scappbundlename})
 
-elseif(WIN32)
+elseif(WIN32 AND NOT MINGW)
 
     if(NOT MSVC)
         set_target_properties(SuperCollider PROPERTIES RUNTIME_OUTPUT_DIRECTORY "$<CONFIG>")
@@ -473,7 +473,7 @@ endif()
 # mac/windows: find the Qt deploy utility.
 # See https://doc.qt.io/qt-5/windows-deployment.html for windeployqt
 # See https://doc.qt.io/qt-5/osx-deployment.html for macdeployqt
-if(APPLE OR WIN32)
+if(APPLE OR MSVC)
     if(APPLE)
         find_program(DEPLOY_PROG macdeployqt PATHS ${CMAKE_PREFIX_PATH} PATH_SUFFIXES bin)
         # only the IDE executable is scanned normally, so force scanning of sclang as well
diff --git a/external_libraries/hidapi/CMakeLists.txt b/external_libraries/hidapi/CMakeLists.txt
index ce5937e..5af9f46 100644
--- a/external_libraries/hidapi/CMakeLists.txt
+++ b/external_libraries/hidapi/CMakeLists.txt
@@ -26,7 +26,7 @@ if( HID_DEBUG_PARSER )
 endif()
 
 # some default libraries
-if (NOT WIN32)
+if (NOT MSVC)
 	find_package(Pthreads)
 	if (NOT PTHREADS_FOUND)
 	    message(SEND_ERROR "cannot find libpthreads")
@@ -113,7 +113,7 @@ if( HID_DEBUG_PARSER OR HID_INSTALL_HUT )
     set(scappbundlename "SuperCollider")
     set(scappauxresourcesdir "${scappbundlename}/${scappbundlename}.app/Contents/Resources")
     set(HID_HUT_PATH "${CMAKE_INSTALL_PREFIX}/${scappauxresourcesdir}/HID_Support")
-  elseif(WIN32)
+  elseif(MSVC)
     set(auxresourcesdir "SuperCollider" CACHE STRING "Resources directory")
     set(HID_HUT_PATH "${CMAKE_INSTALL_PREFIX}/${auxresourcesdir}/HID_Support")
   else()
diff --git a/lang/CMakeLists.txt b/lang/CMakeLists.txt
index 561023d..75bb510 100644
--- a/lang/CMakeLists.txt
+++ b/lang/CMakeLists.txt
@@ -253,7 +253,7 @@ else()
 	target_compile_definitions(libsclang PUBLIC NO_INTERNAL_SERVER)
 endif()
 
-if (NOT WIN32)
+if (NOT MSVC)
 	set_property(TARGET libsclang
 		PROPERTY OUTPUT_NAME sclang)
 endif()
@@ -346,6 +346,10 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux")
 	target_link_libraries(libsclang rt)
 endif()
 
+if(MINGW)
+	target_link_libraries(libsclang shlwapi)
+endif()
+
 target_link_libraries(libsclang ${YAMLCPP_LIBRARY})
 
 add_executable(sclang LangSource/cmdLineFuncs.cpp ${RES_FILES})
@@ -372,7 +376,7 @@ if(APPLE)
             COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:sclang> ${CMAKE_INSTALL_PREFIX}/${scappbindir}
             )
     endif()
-elseif(WIN32)
+elseif(WIN32 AND NOT MINGW)
     if(NOT MSVC)
         set_target_properties(sclang PROPERTIES RUNTIME_OUTPUT_DIRECTORY "$<CONFIG>")
     endif(NOT MSVC)
diff --git a/server/plugins/CMakeLists.txt b/server/plugins/CMakeLists.txt
index 171dfb6..87853e9 100644
--- a/server/plugins/CMakeLists.txt
+++ b/server/plugins/CMakeLists.txt
@@ -301,7 +301,7 @@ if (APPLE)
 	endif()
 endif()
 
-if (WIN32)
+if (WIN32 AND NOT MINGW)
 	foreach(plugin ${plugins} ${supernova_plugins})
 		add_custom_command(TARGET ${plugin}
 			POST_BUILD
diff --git a/server/scsynth/CMakeLists.txt b/server/scsynth/CMakeLists.txt
index 3cad565..87782c1 100644
--- a/server/scsynth/CMakeLists.txt
+++ b/server/scsynth/CMakeLists.txt
@@ -176,7 +176,7 @@ endif()
 
 target_compile_definitions(libscsynth PUBLIC  SC_MEMORY_ALIGNMENT=32)
 
-target_link_libraries(libscsynth tlsf)
+target_link_libraries(libscsynth tlsf ${PTHREADS_LIBRARIES})
 
 find_library(DL NAMES dl)
 if(DL)
@@ -234,11 +234,11 @@ endif()
 target_include_directories(libscsynth PUBLIC ${boost_include_dirs})
 
 if (WIN32)
-	target_link_libraries(libscsynth wsock32 ws2_32 winmm)
+	target_link_libraries(libscsynth wsock32 ws2_32 winmm shlwapi)
 	target_compile_definitions(libscsynth PUBLIC UNICODE _UNICODE)
 endif()
 
-if(NOT WIN32)
+if(NOT MSVC)
 set_property(TARGET libscsynth PROPERTY OUTPUT_NAME scsynth)
 endif()
 
@@ -275,10 +275,6 @@ if(AUDIOAPI STREQUAL bela)
     target_link_libraries(scsynth ${XENOMAI_LIBRARIES} ${BELA_LIBRARIES} belaextra)
 endif()
 
-if (PTHREADS_FOUND)
-    target_link_libraries(scsynth ${PTHREADS_LIBRARIES})
-endif()
-
 if(LTO)
     set_property(TARGET scsynth libscsynth
                  APPEND PROPERTY COMPILE_FLAGS "-flto -flto-report")
@@ -303,7 +299,7 @@ if(APPLE)
             COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:scsynth> ${CMAKE_INSTALL_PREFIX}/${scappauxresourcesdir}
             )
     endif()
-elseif(WIN32)
+elseif(WIN32 AND NOT MINGW)
     if(NOT MSVC)
       target_link_libraries(scsynth "-municode")
       set_target_properties(scsynth libscsynth PROPERTIES RUNTIME_OUTPUT_DIRECTORY "$<CONFIG>")
@@ -345,8 +341,13 @@ elseif(WIN32)
     )
 
 else()
+    if(MINGW)
+      target_link_libraries(scsynth "-municode")
+    endif()
+
 	install(TARGETS ${INSTALL_TARGETS}
 			RUNTIME DESTINATION "bin"
+			ARCHIVE DESTINATION "lib${LIB_SUFFIX}"
 			LIBRARY DESTINATION "lib${LIB_SUFFIX}"
 			PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
 endif()
diff --git a/server/supernova/CMakeLists.txt b/server/supernova/CMakeLists.txt
index 6e92edd..e768bdf 100644
--- a/server/supernova/CMakeLists.txt
+++ b/server/supernova/CMakeLists.txt
@@ -85,7 +85,7 @@ if(LINUX AND CMAKE_COMPILER_IS_CLANG)
     message(STATUS "Clang on Linux detected, linking to libatomic")
     target_link_libraries(libsupernova atomic)
 endif()
-if(NOT WIN32)
+if(NOT MSVC)
   set_property(TARGET libsupernova
                PROPERTY OUTPUT_NAME supernova)
 endif()
@@ -201,14 +201,14 @@ endif()
 target_link_libraries(libsupernova boost_system_lib boost_program_options_lib)
 target_include_directories(libsupernova PUBLIC ${boost_include_dirs})
 
-if(CMAKE_COMPILER_IS_GNUCXX)
+if(CMAKE_COMPILER_IS_GNUCXX AND NOT MINGW)
     if( ${_gcc_version} VERSION_GREATER 5 )
       target_link_libraries( libsupernova atomic )
     endif()
 endif()
 
 if(WIN32)
-    target_link_libraries(libsupernova wsock32 ws2_32 winmm)
+    target_link_libraries(libsupernova wsock32 ws2_32 winmm shlwapi)
     target_compile_definitions(libsupernova PUBLIC UNICODE _UNICODE)
 endif()
 
@@ -223,7 +223,7 @@ add_executable(supernova
     )
 target_link_libraries(supernova libsupernova)
 
-if(WIN32)
+if(WIN32 AND NOT MINGW)
     if(NOT MSVC)
       target_link_libraries(supernova "-municode")
       set_target_properties(supernova libsupernova PROPERTIES RUNTIME_OUTPUT_DIRECTORY "$<CONFIG>")
@@ -273,6 +273,10 @@ elseif(APPLE)
             )
     endif()
 else()
+    if(MINGW)
+      target_link_libraries(supernova "-municode")
+    endif()
+
   install(TARGETS supernova
           DESTINATION "bin"
           PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
