问题
What's the difference on Windows with cmake and eclipse and MingW if I choose "Eclipse MingW Makefile" or "Eclipse Unix Makefile"?
With the MingW one I always get an error with "sh.exe" (that vanishes if I re-hit "Configure"), with the Unix one I always have to specifiy windres manually because cmake can't find it.
Does this make any difference for Eclipse or something else?
Both generated Makefiles work with Eclipse and MingW and compile my project.
What Makefile should I choose? And why?
回答1:
This is really a mess.
CMake has a number of different Makefile generators on Windows: MSYS, MinGW, NMake, and Unix. The CDT generator works on top of the Makefile generators by also generating an Eclipse project for you. Currently, only MinGW, NMake, and Unix are supported by the CDT generator.
The difference between these are which "make" flavor it uses. MinGW, MSYS, and Unix are all variants of GNU make (in this context, Unix means "Cygwin"). The difference between these are mostly related to how commands are executed, more specifically which shell is used to execute the commands. GNU make will try very hard to use "sh.exe" instead of "cmd.exe", and this is usually where things go wrong: having a command in a Makefile which assumes details about which shell being used for execution. Another problem when choosing GNU make flavor is to figure out which standard Unix utilities are available (sed/grep/etc). One notable detail is that if GNU make is using cmd.exe to execute commands, it will not support parallell builds.
If you use Unix Makefiles, CMake will assume that your make is a Cygwin one, with full Unix emulation.
Also make sure that you actually run the "right" make. If you have generated Unix Makefiles, but you have MinGW make first in your PATH, then typing "make" in your build tree is likely to fail with weird errors.
But about your question: it really doesn't matter as long as it works.
回答2:
cmake -G"MSYS Makefiles"
helps a lot when compiling for MinGW
来源:https://stackoverflow.com/questions/7000780/eclipse-cmake-windows-mingw-what-makefile-generator