Alternative: Install Windows Subsystem for Linux
The GNU compilers, make and Cmake are easily available for native Windows, as follows:
- Download MinGW-w64 compiler (gcc, g++ gfortran)
- Install to
C:\mingwusing: Architecture: x86_64, Threads: posix, Exception: seh.
This also installs
- For convenience, symlink
cd C:\mingw\bin mklink make.exe mingw32-make.exe
- install CMake
CMake on Windows
Within the project code directory, in general build programs that have
CMakeLists.txt on Windows (and other operating systems) with:
cd build cmake -G "MinGW Makefiles" .. cmake --build . cmake --build . --target install # optional
Do not use
Run As Administrator for
cmake in general.
Note that on Windows, CMake defaults
make to Visual Studio and Nmake.
cmake options above for Windows direct the build to MinGW.
sh.exe error with cmake
I get a nuisance error from
sh.exe being on the Path:
sh.exe was found in your PATH, here: C:/Program Files/Git/user/bin/sh.exe For MinGW make to work correctly sh.exe must NOT be in your path. Run cmake from a shill that does not have sh.exe in your PATH. If you want to use a UNIX shell, then use MSYS Makefile
this message by adding
-DCMAKE_SH="CMAKE_SH-NOTFOUND" to the
cmake command, like:
cmake -G "MinGW Makefiles" -DCMAKE_SH="CMAKE_SH-NOTFOUND" ..