[CMake] MinGW Compilers on Windows
Kevan Hashemi
hashemi at brandeis.edu
Fri Dec 15 10:39:55 EST 2017
Dear Alan,
Thank you for your encouragement to use the "MinGW Makefiles" generator on Windows, and for pointing
out the mingw32-make alternative to just "make" in MSYS.
> So if you are further interested in the "MinGW Makefiles" generator,
> you should remove all sh.exe versions from your PATH (including sh.exe
> provided by raw Windows), get into a CMD environment, execute cmake
> with the "MinGW Makefiles", and then build your software with
>
> mingw32-make.exe
I installed the latest version of MinGW with MSYS on my 32-bit Windows 7 virtual machine (which is
running in VMBox on a MacOS 10.12.6 host computer). I open a CMD terminal (DOS prompt). I do not
move any sh.exe files. I run cmake with -G "MinGW Makefiles" for Executable_A. The configuration and
generation complete with no errors and only one warning. In the CMD terminal, I use mingw32-make.exe
to build Executable_A. The executable runs perfectly when linked dynamically to libraries I
previously built with "MSYS Makefiles".
I repeat the above process, but when it comes to the build itself, I switch from the CMD terminal to
the MSYS terminal, and use mingw32-make.exe instead of just "make" (as noted previously, "make"
takes me to an alternate shell with a Microsoft copyright). The build completes and Executable_A
runs just fine.
I rebuild my libraries with the "MinGW Makefiles" process, staying in the CMD terminal for both
stages. The CMake completes with a few minor warnings. The CMD build proceeds at about the same
speed as the MSYS build (you found the CMD build to be faster). When the build completes, I run
Executable_A linking dynamically to the new set of "MinGW Makefiles" libraries. The executable runs
perfectly.
Conclusion: Easiest way to get MinGW Makefile generation is to do it in the CMD terminal. After
that, you make with mingw32-make in eithger CMD or MSYS. Libraries compiled with either process are
compatible with one another at any stage of compiling or linking.
Yours, Kevan
--
Kevan Hashemi, Electrical Engineer
Physics Department, Brandeis University
http://alignment.hep.brandeis.edu/
More information about the CMake
mailing list