diff --git a/cxxfem/CMakeLists.txt b/cxxfem/CMakeLists.txt
index 0f411750f2a427e01fa28fa7b17e0c660290076e..67d856291aca6db9ceaf819d9441e2f746e6d374 100644
--- a/cxxfem/CMakeLists.txt
+++ b/cxxfem/CMakeLists.txt
@@ -59,7 +59,7 @@ IF(FEM_USE_MKL)
     MESSAGE(STATUS "MKL_INCLUDE_DIRS=${MKL_INCLUDE_DIRS}")
     # library (mkl_rt.so) searched using LIBRARY_PATH (Linux/macOS) or LIB (windows)
     FIND_LIBRARY(MKL_LIBRARIES mkl_rt PATHS ENV LIBRARY_PATH)
-    IF(MSVC)
+    IF(MSVC OR MINGW)
         # with MSVC+MKL, we must link to intel OpenMP so that we have only 1 OpenMP lib
         FIND_LIBRARY(INTEL_OPENMP libiomp5md)
         MESSAGE(STATUS "INTEL_OPENMP=${INTEL_OPENMP}")
diff --git a/cxxfem/src/CMakeLists.txt b/cxxfem/src/CMakeLists.txt
index 70001b65f772570822ef55aafa6e14cf5fc7aa33..dfd4a91ea05dd653d2a9cbd15604492274beecae 100644
--- a/cxxfem/src/CMakeLists.txt
+++ b/cxxfem/src/CMakeLists.txt
@@ -8,9 +8,12 @@ ENDIF()
 IF(FEM_USE_MKL)
     TARGET_LINK_LIBRARIES(fem PUBLIC ${MKL_LIBRARIES})
     TARGET_INCLUDE_DIRECTORIES(fem PUBLIC ${MKL_INCLUDE_DIRS})
-    # with MSVC+MKL, we must link to intel OpenMP so that we have only 1 OpenMP lib
+    # with MSVC+MKL or MinGW+MKL, we must link to intel OpenMP so that we have only 1 OpenMP lib
     IF(MSVC)
         TARGET_LINK_OPTIONS(fem PUBLIC -NODEFAULTLIB:"vcomp" -NODEFAULTLIB:"vcompd")
         TARGET_LINK_LIBRARIES(fem PUBLIC ${INTEL_OPENMP})
     ENDIF()
+    IF(MINGW)
+        TARGET_LINK_LIBRARIES(fem PUBLIC ${INTEL_OPENMP})
+    ENDIF()
 ENDIF()
\ No newline at end of file
diff --git a/envs/win-mingw64.cmd b/envs/win-mingw64.cmd
index b251dca5d999605e8c9155ad2907295018a1694c..105d323801a8ef1b88e8a5e32cd6712e50162039 100644
--- a/envs/win-mingw64.cmd
+++ b/envs/win-mingw64.cmd
@@ -1,90 +1,16 @@
 @echo off
 :: This file opens a terminal which allows you to compile the code with
-:: a 64-bit mingw compiler
-::     https://mingw-w64.org/
-::     https://www.msys2.org/
-::
-:: HOW TO USE THIS FILE?
-::   [check the PATHs below]
-::   [run this file]
-::   mkdir build
-::   cd build
-::   cmake ..
-::   make
-::   ctest
-::
-:: How to clean the "build" folder using cmd line?
-::   cd build
-::   rd /q /s .
+:: MinGW on Windows
 
-echo setting MinGW64 environment...
-
-:: set the location of gmsh SDK / mingw compiler
-set GMSHSDK=%~dp0..\lib\gmsh-sdk
-set EIGEN=%~dp0..\lib\eigen
-set COMPILERPATHS=C:\msys64\mingw64\bin;C:\mingw-w64\mingw64\bin
-
-:: perform some tests...
-IF NOT EXIST %GMSHSDK% (
-    ECHO   - gmsh-sdk NOT found in %GMSHSDK%!!
-    PAUSE
-    EXIT /B
-) ELSE (
-    ECHO   - gmsh-sdk found in %GMSHSDK%.
-)
-
-IF NOT EXIST %EIGEN% (
-    ECHO   - eigen NOT found in %EIGEN%!!
-    PAUSE
-    EXIT /B
-) ELSE (
-    ECHO   - eigen found in %EIGEN%.
-)
-
-FOR %%a IN (%COMPILERPATHS%) DO (
-    IF EXIST %%a (
-        ECHO   - compiler found in %%a.
-        SET COMPILERPATH=%%a
-    ) ELSE (
-        IF NOT DEFINED COMPILERPATH (
-            ECHO   - compiler not found in %%a.
-        )
-    )
-)
-IF NOT DEFINED COMPILERPATH (
-    ECHO   =^> compiler NOT found!
-    PAUSE
-    EXIT /B 
-)
+set COMPILERPATH="C:\mingw-w64"
 
 :: Intel MKL
 set "INTELPATH=C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.5.281\windows"
-set LIB=%INTELPATH%\mkl\lib\intel64_win;%INTELPATH%\compiler\lib\intel64_win;%LIB%
-set INCLUDE=%INTELPATH%\mkl\include;%INCLUDE%
-:: does not always work 
-@REM call %INTELPATH%\mkl\bin\mklvars.bat intel64 vs2019
-
-
-:: where is gmsh.exe and gmsh-**.dll ?
-set PATH=%GMSHSDK%\bin;%GMSHSDK%\lib;%PATH%
-:: where is gmsh.h ?
-set INCLUDE=%EIGEN%;%GMSHSDK%\include;%INCLUDE%
-:: where is gmsh.lib ?
-set LIB=%GMSHSDK%\lib;%LIB%
-:: where is gmsh.py ? (required only if you want to use the python API)
-set PYTHONPATH=%GMSHSDK%\lib;%PYTHONPATH%
-:: add path to the compiler to the PATH
-set PATH=%COMPILERPATH%;%PATH%
-:: add current folder to PATH for cmake/make aliases
-set PATH=%~dp0;%PATH%
-
-:: clear local vars
-set GMSHSDK=
-set EIGEN=
-set COMPILERPATHS=
-set COMPILERPATH=
+@REM set LIB=%INTELPATH%\mkl\lib\intel64_win;%INTELPATH%\compiler\lib\intel64_win;%LIB%
+@REM set INCLUDE=%INTELPATH%\mkl\include;%INCLUDE%
+call "%INTELPATH%\mkl\bin\mklvars.bat" intel64 vs2019
 
-:: open terminal
+:: set the environment of the MinGW compiler
 CD /d "%~dp0"
 CD ..
-%comspec% /K
+%comspec% /k "%COMPILERPATH%\mingw-w64.bat"