--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -37,7 +37,7 @@ if(APPLE)
 endif()
 
 CMAKE_DEPENDENT_OPTION(USE_CRYPTO_OPENSSL "Use OpenSSL instead of MbedTLS for cryptography in STK." ON
-    "NOT USE_SWITCH;NOT WIN32" OFF)
+    "NOT USE_SWITCH;NOT MSVC" OFF)
 CMAKE_DEPENDENT_OPTION(BUILD_RECORDER "Build opengl recorder" ON
     "NOT SERVER_ONLY;NOT APPLE;NOT USE_SWITCH" OFF)
 CMAKE_DEPENDENT_OPTION(USE_SYSTEM_SQUISH "Use system Squish library instead of the built-in version, when available." ON
@@ -51,7 +51,7 @@ if (DLOPEN_MOLTENVK)
     ADD_DEFINITIONS(-DDLOPEN_MOLTENVK)
 endif()
 
-if((UNIX AND NOT APPLE) OR NINTENDO_SWITCH)
+if(UNIX OR MINGW OR NINTENDO_SWITCH)
     include(FindPkgConfig)
 endif()
 
@@ -163,13 +163,10 @@ endif()
 if(WIN32)
     ADD_DEFINITIONS(-DUNICODE)
     ADD_DEFINITIONS(-D_UNICODE)
-    if(NOT IS_DIRECTORY "${PROJECT_SOURCE_DIR}/${DEPENDENCIES}")
-        message(FATAL_ERROR "Dependencies directory not found, make sure dependencies-win-(arch) exists inside stk-code directory.")
-    endif()
 endif()
 
 # These variables enable MSVC to find libraries located in "dependencies"
-if(WIN32)
+if(MSVC)
     set(ENV{PATH} "$ENV{PATH};${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/include")
     set(ENV{LIB} ${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/lib)
     set(ENV{OPENALDIR} ${PROJECT_SOURCE_DIR}/${DEPENDENCIES})
@@ -364,7 +361,7 @@ include_directories(BEFORE "${PROJECT_SOURCE_DIR}/lib/irrlicht/include")
 # of the added include directory.
 if(USE_WIIUSE)
     # Find system WiiUse library or build it if missing
-    if((UNIX AND NOT (APPLE OR HAIKU)) AND USE_SYSTEM_WIIUSE)
+    if((UNIX OR MINGW) AND USE_SYSTEM_WIIUSE)
         find_package(WiiUse)
     endif()
 
@@ -499,9 +496,6 @@ if(WIN32)
     # By default windows.h has macros defined for min and max that screw up everything
     add_definitions(-DNOMINMAX)
 
-    # And shut up about unsafe stuff
-    add_definitions(-D_CRT_SECURE_NO_WARNINGS)
-
     # Avoid timespec structure redeclaration on Visual Studio 2015
     if (NOT (MSVC_VERSION LESS 1900))
         add_definitions(-DHAVE_STRUCT_TIMESPEC)
@@ -584,23 +578,11 @@ if(APPLE AND NOT IOS)
             COMMAND ln -f -s ${PROJECT_SOURCE_DIR}/data ${CMAKE_BINARY_DIR}/bin/supertuxkart.app/Contents/Resources)
     endif()
 else()
-    if (NOT WIN32)
-        find_library(PTHREAD_LIBRARY NAMES pthread ${PTHREAD_NAMES} PATHS ${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/lib)
+    if (NOT MSVC)
+        find_library(PTHREAD_LIBRARY NAMES pthread ${PTHREAD_NAMES})
         mark_as_advanced(PTHREAD_LIBRARY)
     endif()
 
-    # Set data dir (absolute or relative to CMAKE_INSTALL_PREFIX)
-    if(NOT STK_INSTALL_DATA_DIR_ABSOLUTE)
-        get_filename_component(STK_INSTALL_DATA_DIR_ABSOLUTE ${STK_INSTALL_DATA_DIR} ABSOLUTE)
-        if(${STK_INSTALL_DATA_DIR_ABSOLUTE} STREQUAL ${STK_INSTALL_DATA_DIR})
-            add_definitions(-DSUPERTUXKART_DATADIR=\"${STK_INSTALL_DATA_DIR_ABSOLUTE}\")
-        else()
-            add_definitions(-DSUPERTUXKART_DATADIR=\"${CMAKE_INSTALL_PREFIX}/${STK_INSTALL_DATA_DIR}\")
-        endif()
-    else()
-        add_definitions(-DSUPERTUXKART_DATADIR=\"${STK_INSTALL_DATA_DIR_ABSOLUTE}\")
-    endif()
-
     # Build the final executable
     if (IOS)
         file(GLOB IOS_ASSETS_FILES ${IOS_ASSETS} ${IOS_LAUNCHSCREEN} ${IOS_IMAGES_XCASSETS})
@@ -624,7 +606,7 @@ else()
     else()
         add_executable(supertuxkart ${STK_SOURCES} ${STK_RESOURCES} ${STK_HEADERS})
     endif()
-    if (NOT WIN32)
+    if (NOT MSVC)
         target_link_libraries(supertuxkart ${PTHREAD_LIBRARY})
     endif()
 endif()
@@ -840,7 +822,7 @@ if(USE_WIIUSE)
     if(APPLE)
         find_library(BLUETOOTH_LIBRARY NAMES IOBluetooth PATHS /Developer/Library/Frameworks/IOBluetooth.framework)
         target_link_libraries(supertuxkart wiiuse ${BLUETOOTH_LIBRARY})
-    elseif(WIN32)
+    elseif(MSVC)
         add_definitions(-DWIIUSE_STATIC)
         if(WIIUSE_BUILD)
             target_link_libraries(supertuxkart wiiuse)
@@ -855,25 +837,20 @@ if(USE_WIIUSE)
 endif()
 
 if(MSVC OR MINGW)
-  target_link_libraries(supertuxkart iphlpapi.lib)
-  add_custom_command(TARGET supertuxkart POST_BUILD
-    COMMAND ${CMAKE_COMMAND} -E copy_directory
-        "${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/bin"
-        $<TARGET_FILE_DIR:supertuxkart>)
+  target_link_libraries(supertuxkart iphlpapi)
   add_custom_target(stkshaders SOURCES ${STK_SHADERS})
 endif()
 
 if(MSVC)
   SET(CMAKE_SHARED_LINKER_FLAGS /MANIFEST:NO)
   add_custom_command(
-    TARGET supertuxkart POST_BUILD COMMAND "mt.exe" 
-    -manifest \"${PROJECT_SOURCE_DIR}\\windows\\dpi_aware.manifest\" 
+    TARGET supertuxkart POST_BUILD COMMAND "mt.exe"
+    -manifest \"${PROJECT_SOURCE_DIR}\\windows\\dpi_aware.manifest\"
     -inputresource:\"$<TARGET_FILE:supertuxkart>\"\;\#1
     -outputresource:\"$<TARGET_FILE:supertuxkart>\"\;\#1)
 endif()
 
 if(MINGW)
-  SET(CMAKE_SHARED_LINKER_FLAGS /MANIFEST:NO)
   target_sources(supertuxkart PRIVATE windows/windows_config.rc)
 endif()
 
@@ -882,18 +859,6 @@ if(MINGW)
     if (NOT CMAKE_BUILD_TYPE MATCHES Debug)
         target_link_libraries(supertuxkart -mwindows)
     endif()
-    find_file(LIBGCC NAMES "libgcc_s_dw2-1.dll" "libgcc_s_sjlj-1.dll" "libgcc_s_seh-1.dll" PATHS ${CMAKE_FIND_ROOT_PATH})
-    if (LIBGCC)
-        file(COPY ${LIBGCC} DESTINATION ${CMAKE_BINARY_DIR}/bin/)
-    endif()
-    find_file(LIBSTDCPP NAMES "libstdc++-6.dll" PATHS ${CMAKE_FIND_ROOT_PATH})
-    if (LIBSTDCPP)
-        file(COPY ${LIBSTDCPP} DESTINATION ${CMAKE_BINARY_DIR}/bin/)
-    endif()
-    find_file(LIBPTHREAD NAMES "winpthread-1.dll" "libwinpthread-1.dll" "pthreadGC2.dll" PATHS ${CMAKE_FIND_ROOT_PATH})
-    if(LIBPTHREAD)
-        file(COPY ${LIBPTHREAD} DESTINATION ${CMAKE_BINARY_DIR}/bin/)
-    endif()
 endif()
 
 
@@ -955,8 +920,3 @@ install(FILES data/supertuxkart_256.png DESTINATION share/icons/hicolor/256x256/
 install(FILES data/supertuxkart_512.png DESTINATION share/icons/hicolor/512x512/apps RENAME supertuxkart.png)
 install(FILES data/supertuxkart_1024.png DESTINATION share/icons/hicolor/1024x1024/apps RENAME supertuxkart.png)
 install(FILES data/net.supertuxkart.SuperTuxKart.metainfo.xml DESTINATION share/metainfo)
-
-if(MINGW)
-    install(DIRECTORY ${CMAKE_BINARY_DIR}/bin/ DESTINATION ${STK_INSTALL_BINARY_DIR}
-            FILES_MATCHING PATTERN "*.dll")
-endif()
--- a/cmake/FindFreetype.cmake
+++ b/cmake/FindFreetype.cmake
@@ -9,7 +9,7 @@
 # FREETYPE_LIBRARIES
 #     Freetype library list
 
-if(WIN32)
+if(MSVC)
     find_path(FREETYPE_INCLUDE_DIRS NAMES freetype/freetype.h PATHS "${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/include/freetype2")
     find_library(FREETYPE_LIBRARY NAMES freetype libfreetype PATHS "${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/lib")
     set(FREETYPE_FOUND 1)
@@ -22,4 +22,3 @@ elseif(APPLE OR ${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
 else()
     pkg_check_modules(FREETYPE freetype2)
 endif()
-
--- a/cmake/FindWiiUse.cmake
+++ b/cmake/FindWiiUse.cmake
@@ -61,7 +61,7 @@ set(_deps_check)
 if(WIN32)
 	find_file(WIIUSE_RUNTIME_LIBRARY
 		NAMES
-		wiiuse.dll
+		libwiiuse.dll
 		HINTS
 		"${_libdir}"
 		"${_libdir}/.."
--- a/src/io/file_manager.cpp
+++ b/src/io/file_manager.cpp
@@ -176,8 +176,8 @@ FileManager::FileManager()
     }
     if(exe_path.size()==0 || exe_path[exe_path.size()-1]!='/')
         exe_path += "/";
-    if ( getenv ( "SUPERTUXKART_DATADIR" ) != NULL )
-        root_dir = std::string(getenv("SUPERTUXKART_DATADIR"))+"/data/" ;
+    if ( getenv ( "MINGW_PREFIX" ) != NULL )
+        root_dir = std::string(getenv("MINGW_PREFIX"))+"/share/supertuxkart/data/" ;
 #ifdef __APPLE__
     else if( macSetBundlePathIfRelevant( root_dir ) ) { root_dir = root_dir + "data/"; }
 #endif
