使用在Windows下通过MSYS2安装的cmake 3.5.2,"MinGW Makefiles"发电机丢失 [英] Using cmake 3.5.2 installed through MSYS2 under Windows, "MinGW Makefiles" generator is missing
问题描述
我正在尝试使用MinGW作为编译器在Windows下制作cmake的hello world测试.
此答案建议使用-G
标志运行cmake
,如下所示:
I'm trying an hello world test to make cmake under Windows, using MinGW as compiler.
This answer suggests to run cmake
with the -G
flag as following:
cmake -G "MinGW Makefiles" .
但是,如果执行此操作,则会收到一条消息,指出该发生器不是已知的.
实际上,运行cmake --help
的 Generators 部分下,它列出了以下生成器:
However, if I do this, I get a message saying that that is not a known generator.
Indeed, running cmake --help
, under the Generators section it lists the following generators:
并且您会看到,"MinGW Makefiles"未列出.
and as you can see, "MinGW Makefiles" is not listed.
如果这是相关的,我已经安装了MinGW并在系统上的常规文件夹C:\MinGW
中工作.我还通过默认安装文件夹中的WinBuilds和MSYS2安装了MinGW-w64.
我正在使用通过MSYS2安装的cmake version 3.5.2
.
If this is relevant, I have MinGW installed and working on my system in the usual folder C:\MinGW
. I also have MinGW-w64 installed through WinBuilds and MSYS2, again in the default installation folders.
I'm using cmake version 3.5.2
, installed through MSYS2.
为什么在生成器中未列出"MinGW Makefiles"?
Why is "MinGW Makefiles" not listed among the generators?
推荐答案
只有Windows版本的CMake才知道MinGW Makefiles
和MSYS Makefiles
生成器.
Only the Windows version of CMake does know the MinGW Makefiles
and MSYS Makefiles
generators.
如果您下载了MinGW/MSYS CMake版本,请尝试使用Unix Makefiles
生成器,或者不要使用-G
选项(以自动检测您的编译器工具链).
If you have downloaded the MinGW/MSYS CMake version try using the Unix Makefiles
generator or don't use the -G
option (to auto-detect your compiler toolchain).
如果仍然出现错误,请参见下面的参考.
If you still get errors, please see the references below.
参考
- cmake MSYS Makefiles generator missing
- CMake Error at CMakeLists.txt:30 (project): No CMAKE_C_COMPILER could be found
这篇关于使用在Windows下通过MSYS2安装的cmake 3.5.2,"MinGW Makefiles"发电机丢失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!